[Tutor] Running Existing Python

Steven D'Aprano steve at pearwood.info
Sat Feb 26 23:26:12 CET 2011


Justin Bonnell wrote:

> --This is the location of the file:
> 
> 	/jwbonnell/bin/Python 2.7/Extras/Demo/tkinter/guido/hello.py


I doubt that. Mac OS is a type of Unix, and it would shock me if it puts 
home directories (the jwbonnell/ part) directly under the file system 
root /


My guess is that the correct path is probably

/home/jwbonnell/bin/Python 2.7/Extras/Demo/tkinter/guido/hello.py

but of course I could be wrong. Don't forget to quote the path, 
otherwise the spaces will mess things up for you:

"/home/jwbonnell/bin/Python 2.7/Extras/Demo/tkinter/guido/hello.py"

Try running this command from your command prompt:

locate hello.py

and see if it gives anything useful. (I don't know if OS X comes with 
locate as standard, so don't be surprised if you get an error.)

Another alternative would be to refer to the file using:

python ~/"bin/Python 2.7/Extras/Demo/tkinter/guido/hello.py"

Note that you don't quote the tilde ~ at the start.



-- 
Steven



More information about the Tutor mailing list