Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nicolaius

macrumors newbie
Original poster
Jan 4, 2009
7
0
Hi, everyone. I hate to be "that guy" whose first post is some idiotic question, and normally I would just lurk around google until I found someone else who asked the same thing with the question answered, but I guess my eyes weren't as sharp this time around.

I have a very basic knowledge of C++, but as of today I began learning some python.

Anyway, my problem is just straight up running .py files. I've saved some very basic code, and when I open it, the python launcher and the terminal both launch on the dock. The python launcher does nothing at all but just look pretty with the light under it on the dock, and terminal just opens normally as if I just...well, straight up opened terminal. Either way, it's not doing what I wanted. I considered the option that I didn't properly code the app so that it would pause the console, but even after I did that...same problem.

Of course, any help would be greatly appreciated.

Thanks a lot,
Nico
 

Nicolaius

macrumors newbie
Original poster
Jan 4, 2009
7
0
I also tried that. But whenever I do I get an error message from terminal. Here's all of the text:

Last login: Sun Jan 4 15:51:30 on ttys000
my-macbook:~ Nicola$ python game_over.py
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python: can't open file 'game_over.py': [Errno 2] No such file or directory
my-macbook:~ Nicola$ python
Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> /Users/Nicola/Documents/Python\ Source_Examples/chapter02/game_over2.py
File "<stdin>", line 1
/Users/Nicola/Documents/Python\ Source_Examples/chapter02/game_over2.py
^
SyntaxError: invalid syntax
>>>
 

ReadyEddy

macrumors newbie
Jan 4, 2009
1
0
In terminal
Either
navigate to the location of the python file i.e.
cd /Users/Nicola/Documents/Python\ Source_Examples/chapter02
then launch python i.e.
python game_over2.py
Or quote the full path i.e.
python /Users/Nicola/Documents/Python\ Source_Examples/chapter02/game_over2.py

Some comments that may help.
If you installed python yourself without realizing that Python 2.5 is already installed on your system, its best to work out where the second has been put on your system and consider whether you want to keep it on your system.
Do not delete the system python under any circumstances.
You are going to have to learn about the command line i.e. unix as well as python.
Good Luck
 

Nicolaius

macrumors newbie
Original poster
Jan 4, 2009
7
0
Thank you very much, guys. But um...I'm not sure I understood any of the directly above. I think that's what I just did was navigate there? I just posted the error message. And I'm aware of my system's python vs. other pythons, the only "external" python i have is just the IDLE program. The rest is the original.
 

Cromulent

macrumors 604
Oct 2, 2006
6,817
1,102
The Land of Hope and Glory
Thank you very much, guys. But um...I'm not sure I understood any of the directly above. I think that's what I just did was navigate there? I just posted the error message. And I'm aware of my system's python vs. other pythons, the only "external" python i have is just the IDLE program. The rest is the original.

The error message you got was no such file or directory. You need to navigate to the correct folder first using cd (change directory) and then when you are in the correct folder then type python filename.py.
 

Nicolaius

macrumors newbie
Original poster
Jan 4, 2009
7
0
Ah ok I understand now thank you. But I realized today I probably should have made myself clearer, what I really want to do is convert my .py file somehow to a straight-up executable so that I can just double click and run it.
 

Nicolaius

macrumors newbie
Original poster
Jan 4, 2009
7
0
Ok, so in order to do what i just asked above (make a straight-up application from python code), I did some research and found out I apparently need something called py2app. This is a python egg, which I had no idea how to install. I read a bit and opened terminal and got permission denied, so then i did the sudo thing and typed in my password and then it gave me this error:

sudo: /Users/Nicola/Desktop/setuptools-0.6c9-py2.5.egg: command not found


great. Nothing seems to work for me these days *sigh*.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.