Sign in to follow this  

Python error when I tried to start...

This topic is 3624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I compiled a game (frets on fire if it means anything) and I got an error when I tried to start the game. "No module named difflib" From research I have found that difflib comes with the standard python install? I already have the difflib file from my python install. The reason I am posting here is because I don't know why the compile didn't work, where would I have missed something not to include "difflib"?

Share this post


Link to post
Share on other sites
Have you rebooted your computer since you've installed python? If not, the environment variables for your Python installation may not be registering properly for the application.

Share this post


Link to post
Share on other sites
You compiled python code? With what tool / to what?

I can import difflib fine, here, so I'm thinking that whatever you did to compile might be the reason why you can't import difflib.

Share this post


Link to post
Share on other sites
I used command prompt, if I do remember correctly it was something along the lines of pye2exe extension or something like that.

I have restarteded the computer many times since instillation, but I will try and reinstall then restart and see if that makes a difference.

Share this post


Link to post
Share on other sites
Okay. I have no experience with Py2exe, but I can tell what your problem is.

Py2exe is basically a tool that makes a .exe, which is similar to a zip file in some ways. One is that, inside it, is the entire Python interpreter, any files written by you that it includes, and so on, sort of like an archieve.

But not the standard library. I'm sure you can find a way to include difflib into that .exe, but the easier way is to install the python interpreter on your computer, and just execute the .py file already present. If you *need* to include the difflib file into your exe, please consult Py2exe documentation.

Share this post


Link to post
Share on other sites
Correct, it creates a new folder called dist and I didn't even move that folder I just tried to start it from there. If it makes a difference when I started the game from source (without compiling) it worked but none of the text would appear on screen (just the graphical stuff, none of the actual text).

Share this post


Link to post
Share on other sites
Ok, in the dist directory there should be a file library.zip. Crack that open and check if difflib.py is in there. If it is, then something is wrong with the exe's search and I have no idea how to help you. If it isn't, then something went wrong with the packaging, and you should be able to just add difflib.py to the zip and it may work. Or just give you a different missing module error.

Share this post


Link to post
Share on other sites

This topic is 3624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this