How do you fix all of these py2exe problems? - python

I have been making a game with Python and Pygame, and I've FINALLY finished it! It has a main.py, and this uses 2 other .py files: process.py and classes.py. I have been trying to make it into a standalone .exe (using this setup.py: http://www.pygame.org/wiki/Pygame2exe) but have encountered several difficulties. I used Python 2.6 before, but that gave me two errors. I have just tried 2.7, but I encountered these errors:
C:\Users\Me\Desktop\dist\setup.exe\zipextimporter.py:82: RuntimeWarning: import display: No module named _view
(ImportError: No module named _view)
C:\Users\Me\Desktop\dist\setup.exe\zipextimporter.py:82: RuntimeWarning: import draw: No module named _view
(ImportError: No module named _view)
C:\Users\Me\Desktop\dist\setup.exe\zipextimporter.py:82: RuntimeWarning: import image: No module named _view
(ImportError: No module named _view)
C:\Users\Me\Desktop\dist\setup.exe\zipextimporter.py:82: RuntimeWarning: import pixelcopy: No module named _view
(ImportError: No module named _view)
C:\Users\Me\Desktop\dist\setup.exe\zipextimporter.py:82: RuntimeWarning: import transform: No module named _view
(ImportError: No module named _view)
C:\Users\Me\Desktop\dist\setup.exe\distutils\dist.py:267: UserWarning: Unknown distribution option: 'dist_dir'
error: invalid command 'bdist'
Can anyone help me? I need to fix ALL of these errors! The error that has always appeared is the 'dist_dir' error, and I cannot find a suitable solution for this! I have installed SetupTools for 2.7 and it still comes up, despite being told this would fix it. This is the error that I need to fix the most, so if you only have an appropriate solution for this, that is fine. Thank you!

To answer the first lines of errors add this to your code:
import pygame._view
The last line error is probably with your code. Please post the complete code from your game. Try the first fix and then see if the application runs. Good luck!

Related

ModuleNotFoundError: No module named 'spyder.utils.iofuncs'

I want to load .spydata files with load_dictionary. However for some reason it can't find the module. I thought this was something already in Spyder? I am running spyder 3.3.1 and I don't want to update it for compatibility reasons.
from spyder.utils.iofuncs import load_dictionary
ModuleNotFoundError: No module named 'spyder.utils.iofuncs'
I had the same problem. It seems that load_dictionary and save_dictionary was moved to the the module spyder_kernels, so
from spyder_kernels.utils.iofuncs import load_dictionary
must be used instead, see also
https://github.com/spyder-ide/spyder-kernels/blob/master/spyder_kernels/utils/iofuncs.py .

How should I solve this module not found error '__main __' is not a package?

This is my actual code saved as Cartoonify.py
This is my init.py
#init.py file
from .Cartoonify import Cartoon<br>
__all__= [
"Cartoon"
]
I am getting this following error:
ModuleNotFoundError: No module named '__ main __.Cartoonify'; '__main __' is not a package
If you try to import files from in a package with .something, this error always shows up. Your package needs to be run as package in order to work, so you should get a file outside the package, in which you do:
import <package>
doSomethings()
That should work.

Python QT - No module named 'ui.mainwindow'

i am trying to run my main.py but i always get the same error.
ModuleNotFoundError: No module named 'ui.mainwindow'
I already tried with other commands like ui.MainWindow, ui.mainWindow, Ui.MainWindow but nothing worked. Can someone help me?

Unable to get HttpNegotiateAuth module working. ImportError: DLL load failed

I have the below statement in my python file,
from requests_negotiate_sspi import HttpNegotiateAuth
though i was able to make the authentication work
getting an error - no module named 'pywin32_bootstrap'. to fix this, i tried "pip install pywin32==225"
Got another error - moduleNotFoundError: No module named 'pywintypes'. to fix this i tried pip install pypiwin32
And now i'm getting the below error
c:\programdata\anaconda3\lib\site-packages\requests_negotiate_sspi__init__.py:4: in
from .requests_negotiate_sspi import HttpNegotiateAuth # noqa
c:\programdata\anaconda3\lib\site-packages\requests_negotiate_sspi\requests_negotiate_sspi.py:11: in
import sspi
c:\programdata\anaconda3\lib\site-packages\win32\lib\sspi.py:16: in
import win32security, sspicon
E ImportError: DLL load failed: The specified procedure could not be found.
What would be the best way to get this fixed? i had a look at other similar queries on stackoverflow but could not get this resolved.
I tried doing this, and then it started to work fine without any issues
pip install pywin32==223

Pyinstaller with Django: ModuleNotFoundError: No module named 'django.contrib.admin.apps'

I'm getting an error when trying to run my packaged python application in cmd line:
ModuleNotFoundError: No module named 'django.contrib.admin.apps'
I tried the answer from pyinstaller 3.2 with django 1.10.1, but I still get the same error. The only difference is a ModuleNotFoundError rather than an ImportError. Does anyone know what I could be doing wrong?
In the PyInstaller/hooks/ location you should add the hook file and import hidden modules.
More: https://github.com/pyinstaller/pyinstaller/issues/2332

Categories