LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-11-2008, 11:14 PM   #1
me_lax
LQ Newbie
 
Registered: Aug 2008
Posts: 7

Rep: Reputation: 0
python shell doesn't run idle output


I have recently started using Xubuntu 8.04 Hardy, just installed Idle 1.2.2 and saved helloworld.py as instructed in tutorial. The tutorial says that I will be able to get the output through Run Module(F5) but when I click Run Module it doesn't run the out put and gives me the message:
"There's an error in your program: invalid syntax"
I have checked a thousand times and I dont see any typing errors that I could have made.
Someone please help me to get through this hurdle.
 
Old 09-12-2008, 09:28 AM   #2
me_lax
LQ Newbie
 
Registered: Aug 2008
Posts: 7

Original Poster
Rep: Reputation: 0
I have also tried running the saved file in the terminal: "python helloworld.py" and it gives me this message:

python: can't open file 'helloworld.py': [Errno 2] No such file or directory

I read in couple of posts that you have to give the path to the file. I tried doing that aswell (python /media/e/Programming helloworld.py) but it gives me this message:

python: can't open file 'helloworld.py': [Errno 2] No such file or directory

I tried opening a terminal at the location of the file and tried running the file, it fails to run it from there as well.

What am I doing wrong? I don't think I have made a mistake with the program script because I just copied and pasted it from the Tutorial and saved the file at this location /media/e/Programming where e is my sdb1 mount.

Any help would be greatly appreciated.
 
Old 09-13-2008, 02:10 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,536

Rep: Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506Reputation: 2506
Welcome to Linux Questions.

1) helloworld.py from ?
http://www.pygtk.org/pygtk2tutorial/.../helloworld.py
Which tutorial ?? It is possible that the module 'run.py'
is used, but the command 'python helloworld.py' just works
without displaying anything in the terminal window.

2)'idle' has some bugs, but can "save".
(Seems always to say "invalid syntax" when saving)
..This site also suggests using another tool :
http://groups.google.com/group/comp....d3677c6f70e67f
free wing ide (wingide-101)
http://www.wingware.com/downloads/wingide-101

3) '/media' is not meant to be used for developing,
don't do that. Usually it is a good idea only to use
'/home/"user"/ for such work. (/home/lax/tmp and ..
/home/lax/my_python etc. etc.) Using system "places"
will at some time make your system unusable.

4) To execute a python command : The full path should
work, else : 'cd "to directory where file.py is"' ...
and next 'python file.py'

Good Luck !
 
Old 09-13-2008, 11:55 PM   #4
me_lax
LQ Newbie
 
Registered: Aug 2008
Posts: 7

Original Poster
Rep: Reputation: 0
thanks knudfl,

I think I realized what I mistakes I had made. I didn't realize that you had to have your Python shell opened so that your IDLE Run module worked. When I had both the windows opened, the F5 command worked and I was able to get the output of the script.

What I also realized is that the script files that I had saved through IDLE had some header lines that Python doesn't typically have. That is why it wasn't reading the script files. I tried saving the same file under text editor and that seemed to run okay.

Also, like you said, I realized that it is better to save the files within the home folders so that you don't have permission issues. Saving the files on a Sdb1 device, for me personally, was a hard task to tackle because of the permission issues.

Thanks for attempting to answer and help out. It means a lot. I was a little worried for sometime, and thought that no one really bothered to answer. This forum is a great resource and an excellent information library.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python 2.3 IDLE won't load... arpanet1969 Linux - Software 2 12-31-2004 10:15 AM
Python IDLE apocolpse Programming 2 11-09-2004 08:37 PM
Python Idle apocolpse Programming 2 10-18-2004 04:16 AM
python 2.3 and idle jimscafe Linux - Software 1 10-25-2003 06:01 PM
Python IDLE Interface Odd_Bloke Linux - Software 4 08-26-2003 01:58 PM


All times are GMT -5. The time now is 07:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration