General Development

Py2App Issues – xian_lee

Xian_Lee

Member

Posts: 345
From:
Registered: 03-15-2006
First, let me point out that I'm brand new to Python. I've got some PHP under my belt, and a bit of basic understanding of programming, but I just picked up Python yesterday.

The Python language doesn't seem too difficult, but I'm running into problems compiling (or "Make Applet" in the MacPython IDE) my code. Actually, that's not true, my code compiles perfectly, but my new apps won't run because the media files (images, sounds) are not getting included. When I compile an app without external files (excluding libraries), I have no problems whatsoever, and the apps run nicely.

Does anybody know what I'm doing wrong? Sorry about posting such a newbie question. Thanks!!!

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
Hi xian_lee!
Welcome to CCN - where no question is too noob.

I havent used the py2app my self but just to make sure I have to ask, does your python program run if you just execute the script? Because you dont have to make (build) an executable in order to run your python scripts. Just making sure you know that.

In Christ,
Jari.

------------------
Mat 5:6 Blessed are they which do hunger and thirst after righteousness: for they shall be filled.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

Xian_Lee

Member

Posts: 345
From:
Registered: 03-15-2006
Thanks for the heads up!

Python works just fine when interpreting, all of the files are showing up nicely, I just can't get my images to work with the compiled applet.

Side-stepping a little. Is Python any good for game dev? Not like, extravagant 3D super-games, but the very fun/addicting 2D kind (current game ideas are similar to old Mega Man, Zelda, and other such classics).

D-SIPL

Moderator

Posts: 1345
From: Maesteg, Wales
Registered: 07-21-2001
quote:
Originally posted by xian_lee:
Thanks for the heads up!

Python works just fine when interpreting, all of the files are showing up nicely, I just can't get my images to work with the compiled applet.

Side-stepping a little. Is Python any good for game dev? Not like, extravagant 3D super-games, but the very fun/addicting 2D kind (current game ideas are similar to old Mega Man, Zelda, and other such classics).



You need to make sure that the image paths are correct. Also add the python compiler directory to the top of your scripts.

Python can be used for 3D Game development. Check out PyOGRE and also 3D Cakewalk.

--D-SIPL

------------------
"One World. One Web. One Program." -Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!" -Adolf Hitler

Jari

Member

Posts: 1471
From: Helsinki, Finland
Registered: 03-11-2005
quote:
Originally posted by xian_lee:

Side-stepping a little. Is Python any good for game dev? Not like, extravagant 3D super-games, but the very fun/addicting 2D kind (current game ideas are similar to old Mega Man, Zelda, and other such classics).

Yep it sure is. We are using python for the CCN community project called Bible Dave.

------------------
Mat 5:6 Blessed are they which do hunger and thirst after righteousness: for they shall be filled.

[VoHW] (Help needed) [Blog] - Truedisciple (mp3)

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
is this too n00b?


i can't figure Paint out... how do i do it?


LOL

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
Hi welcome to CCN!

quote:
Originally posted by xian_lee:
Side-stepping a little. Is Python any good for game dev? Not like, extravagant 3D super-games, but the very fun/addicting 2D kind (current game ideas are similar to old Mega Man, Zelda, and other such classics).

Actually, people use Python for 3D stuff (and games) too!
Check it out: http://pyopengl.sourceforge.net/

quote:
Originally posted by buddboy:
is this too n00b?


i can't figure Paint out... how do i do it?


LOL


It's also offtopic

------------------
All Your Base Are Belong To Us!!! chown -r us ./base

"After three days without programming, life becomes meaningless.'' -- Tao of Programming Book 2

[This message has been edited by CPUFreak91 (edited March 16, 2006).]

Xian_Lee

Member

Posts: 345
From:
Registered: 03-15-2006
quote:
Originally posted by D-SIPL:

You need to make sure that the image paths are correct. Also add the python compiler directory to the top of your scripts.


So at the top of my scripts I should have " #! /usr/bin/python " or whatever the path to the compiler is (or would that be /Developer/Python/py2app/ for the py2app compiler)? I guess what's confusing me is the fact that everything runs just peachy in intepreted form. I'm not sure that I've used py2app itself... I think I have, but I know that I've used the "Make Applet" feature in the Python IDE and the Applet Builder program included with MacPython.

Anyway, thanks for the tip!

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
i know it's offtopic, but i just had to challenge that...

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
quote:
Originally posted by Xian_Lee:
So at the top of my scripts I should have " #! /usr/bin/python " or whatever the path to the compiler is (or would that be /Developer/Python/py2app/ for the py2app compiler)? I guess what's confusing me is the fact that everything runs just peachy in intepreted form. I'm not sure that I've used py2app itself... I think I have, but I know that I've used the "Make Applet" feature in the Python IDE and the Applet Builder program included with MacPython.

Anyway, thanks for the tip!



Little hint, everything in python is interpreted. There is no such thing as compiled python. I think that /usr/bin/python is right but I don't own a mac so I really don't know. Try google.

------------------
All Your Base Are Belong To Us!!! chown -r us ./base
"After three days without programming, life becomes meaningless.'' -- Tao of Programming Book 2

Xian_Lee

Member

Posts: 345
From:
Registered: 03-15-2006
quote:
UPDATE: I don/'t think I should have ever installed Python 2.3 on accident. I finally figured out how to get py2app to work properly, and now everything is just great! I don't have to worry about absolute links to support files or anything. All of my files are in a self contained .app file. Yes!

Weird. After more experimenting with my file inclusion issues, I found out that if I put an absolute reference to the files, it all works flawlessly. The good news is... I can now make thing that work. The bad news is... in order for them to work, all support files have to be in a predefined location. Bummer. I'm sure there's a way to make this work with relative references, but I'm content for now. Thanks for the help!

[This message has been edited by Xian_Lee (edited March 17, 2006).]

D-SIPL

Moderator

Posts: 1345
From: Maesteg, Wales
Registered: 07-21-2001
quote:
Originally posted by CPUFreak91:

Little hint, everything in python is interpreted. There is no such thing as compiled python. I think that /usr/bin/python is right but I don't own a mac so I really don't know. Try google.




You can compile Py files... pyc.

--D-SIPL

------------------
"One World. One Web. One Program." -Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!" -Adolf Hitler

Xian_Lee

Member

Posts: 345
From:
Registered: 03-15-2006
I'm confused now. Can python be compiled, or just made into a condensed application file? And if it can be compiled, does that mean that the compiled programs will be faster than the intepreted ones? It's been a while since I've attempted any programming that wasn't web-based.

------------------
If games please me, and if it's possible to please God with games, why on earth wouldn't I make games?

buddboy

Member

Posts: 2220
From: New Albany, Indiana, U.S.
Registered: 10-08-2004
lol i like your signature xian_lee... i think there is a way to compile Python... lol...

------------------
In the stock market, you must buy high and sell low...Wait! That's not right!
--------------
Yes, I can be intelligent at times!!