Mac Applications forum

General discussion

Can any python programmers help me out

by wizardjs / August 23, 2006 6:51 AM PDT

I'm trying to learn python and I've written multiple scripts and saved them and ran them from the IDLE environment by pressing F5, I was wondering how I can execute those scripts from Terminal on a Mac. Everywhere I've read says that to run my saved script called "" i open a terminal window and just type 'python' and it should run the program, but it says:
python: unable to open file

Does anyone know how to fix this ro what to do? Is there some special code i have to type, or something I have to put into the script to make it executable from Terminal?

Thank you

Jake S.

Discussion is locked
You are posting a reply to: Can any python programmers help me out
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Can any python programmers help me out
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
2 ideas.
by R. Proffitt Forum moderator / August 23, 2006 7:21 AM PDT
Collapse -
Some Good Reads
by gilbertwhite1 / August 23, 2006 8:22 AM PDT
In reply to: 2 ideas.
Collapse -
And a great video on python.
by R. Proffitt Forum moderator / August 23, 2006 9:57 AM PDT
In reply to: Some Good Reads

Watch "Guido van Rossum is a computer programmer who is
best known as the author and Benevolent Dictator for ...

Collapse -
Are you in the correct directory?
by 3rdalbum / September 14, 2006 7:18 PM PDT

When you open the terminal, are you sure that you're in the correct directory? Type "pwd" and hit Return to check what directory you are in.

If your .py file is in a different folder than the one you're in, type:

cd "

then drag the folder that contains the .py file, into the terminal. If a space appears at the end of the path when it goes into the terminal, delete the space. Now close the quotes and hit return. This is an example of how it should look:

cd "/home/chris/Python Projects/"

Now type your "python", and it should all run.

I'm not sure exactly where OS X keeps its files, but if you put the line:


at the beginning of your script, and make the script executable, then a simple "./" command in the correct directory will run the script too.

Popular Forums
Computer Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions


Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?