Hi, I am a very new programmer, I started dabbling with python script only 2 days ago because I was on a quest to build a roguelike game, and I found a good informative tutorial on how to do this using python and an API called libtcod. So I figured why not? After 2 days of coding and trial and error. I was able to "reverse Engineer" some code and create a decent game. The game runs fine, But I need it to be a standalone program. I have tried "py2exe" but once my exe is finished I get Traceback Errors:

Traceback (most recent call last):
  File "rogue.py", line 1, in <module>
  File "libtcodpy.pyc", line 41, in <module>
  File "ctypes\__init__.pyc", line 428, in __getitem__
  File "ctypes\__init__.pyc", line 423, in __getattr__
  File "ctypes\__init__.pyc", line 353, in __init__
WindowsError: [Error 126] The specified module could not be found

I have already managed to get past my first problem, py2exe wasn't recognized my script's dependency on the libtcod API. But I foundout how to forcibly include them. but I can't figure out how to fix the traceback errors.

And let me reiterate, I am an absolute beginner to python script. Most of my code was borrowed from the tutorial I read. if anyone could help me it would be much appreciated. I have been trying to do this for about 4 hours straight. It's driving me crazy...

Recommended Answers

utilizing modules like that may be a little above your "pay-grade" at the moment, I don't mean that offensively, I'd just stick with running the script. I'm not sure why you want to turn it into an .exe right now anyways, any reason?

Jump to Post

honestly I'd package the python installer with it or a link to python with which version you're using, everybody has the Java runtime environment on their computer so having python shouldn't be a big deal.

Jump to Post

Why on earth would you need to "protect" your code if most of it has been taken from tutorials anyway?

Basically, when a module is imported it's compiled to bytecode.
Anyway, to read more, see http://effbot.org/zone/python-compile.htm

Of course, you could use distutils -

Jump to Post

All 13 Replies

Some Help? Anyone? I would love to finish this game. it's at a good point at which I can build upon it.. And I do NOT want to scrap it..

utilizing modules like that may be a little above your "pay-grade" at the moment, I don't mean that offensively, I'd just stick with running the script. I'm not sure why you want to turn it into an .exe right now anyways, any reason?

utilizing modules like that may be a little above your "pay-grade" at the moment, I don't mean that offensively, I'd just stick with running the script. I'm not sure why you want to turn it into an .exe right now anyways, any reason?

My reason is, I have a youtube channel and a small fangroup and I'd like to release this to them, plus I have a few friends I want top give it too. but not everyone has Python on there computer so. I wanted to build it as a standalone.

And don't worry I take no offence. Although if you have anyway of offering help, please do.

honestly I'd package the python installer with it or a link to python with which version you're using, everybody has the Java runtime environment on their computer so having python shouldn't be a big deal.

Well if that's the case. How do I compile to a pyc? I want my code protected. I hope it's not painfully obvious.

Well if that's the case. How do I compile to a pyc? I want my code protected. I hope it's not painfully obvious.

Ignore Above said post, I have figured out how to compile. Thank you for replying. I'll mark thread as resolved =] -imGhostofYou

Why on earth would you need to "protect" your code if most of it has been taken from tutorials anyway?

Basically, when a module is imported it's compiled to bytecode.
Anyway, to read more, see http://effbot.org/zone/python-compile.htm

Of course, you could use distutils - http://docs.python.org/distutils/introduction.html

Why do I want "protect" my code.. I really don't know, Just not comfortable with giving my raw coded work... and thanks for the distulis link, I'm looking at it now

Why do I want "protect" my code.. I really don't know, Just not comfortable with giving my raw coded work... and thanks for the distulis link, I'm looking at it now

The best programmers give their raw coded work :) visit http://www.gnu.org/gnu/gnu.html and http://www.linuxlinks.com/
Publish your work with an open source license http://www.opensource.org/licenses/alphabetical

commented: agreed +3

If anyone is interested in playing this game

Here

Which solution did you end up using to make the exe

Which solution did you end up using to make the exe

Instead of packaging as EXE, I just sent the runtime installer with the files, I compiled the code to .pyc as to protect it for now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.