Py2exe worked, but issue in program now - python

I've been trying to get this to work for a while and this error means I have made 'progress'. I'm using Python2.7 and Pygame.
UPDATE:
I fixed this issue by changing File to sys.argv[0]
C:\Python27\dist>Space_Badgers.exe
Traceback (most recent call last):
File "Space_Badgers.py", line 16, in <module>
NameError: name '__file__' is not defined
#This is the code its referring to:
img_dir = path.join(path.dirname(__file__), "img")
Please help, I wouldn't have guessed converting to exe would be so difficult.
Though, I am still new to programming.
UPDATE:
C:\Python27\dist>Space_Badgers.exe
Traceback (most recent call last):
File "Space_Badgers.py", line 163, in <module>
pygame.error: Couldn't open img\10121.png
This is my new issue.
It still runs fine in IDLE.

Related

I have an issue regarding my python to exe app icon and i can't find the problem

everytime i build my app using pyinstaller, i had already put an icon in my python version except that when i run the .exe version i get this message :
Traceback (most recent call last):
File "main.py", line 174, in
File "tkinter_init_.py", line 2136, in wm_iconbitmap
_tkinter.TclError: bitmap "C:\Users\rayan\PycharmProjects\pythonProject\dist\main\dna.ico" not defined
i tried to import the icon using --icon=dna.ico but still nothing
any help please ?

Trying to get pygame to load an image. It worked before, but now all of a sudden it doesn't load the game anymore

This is the error message I get:
Traceback (most recent call last):
File "c:/Users/Bradley Kittle/Desktop/python_class/2nd_game/platform_KING.py", line 10, in <module>
icon = pg.image.load('crown.png')
pygame.error: Couldn't open crown.png
Just open your file manager and ensure that 'crown.png' in present in the same path. If that doesn't solve the issue, check if your required file is in the admin directory. If so, run your IDE as an administrator or just move the file to your user.
Thanks :)

Issue running python script

I'm running a python script called ALPS which installs packages. It has worked, but now spits this error:
Traceback (most recent call last):
File "/usr/bin/alps", line 295, in <module>
initPackages()
File "/usr/bin/alps", line 156, in initPackages
packageMap[line.split(':')[0]].append(line.split(':')[1].strip())
KeyError: 'gnome-icon-theme'
The error occured when I made spelling mistake with the package 'gnome-icon-theme?
This is obviously linked to python, but can anyone point the way to solving this? The source code can be found here: https://github.com/FluidIdeas/alps
thanks
Cliff

Can't import the class of models from the python console in pycharm

Find the following error showed in
"Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name 'Employee'"
I found the solution
Actually i just need to rerun the python console from pycharm

Tkinter not including in pyinstaller

Actually I'm trying to make a local search engine .The code works fine when running in pycharm but after created exe file using pyinstaller with options like --hidden-import=Tkinter --windowed, while try to execute the exe file it shows error like this
D:\untitled\tk\dist\scroll>scroll.exe Traceback (most recent call
last): File "scroll.py", line 28, in ImportError: No module
named Tkinter
Traceback (most recent call last): File "scroll.py", line 219, in
NameError: name 'Frame' is not defined Failed to execute
script scroll
D:\untitled\tk\dist\scroll>
The code written in python 2.7 is attached below I've also tried with python 3 but same problem
http://pastebin.com/4XWfcnzf

Categories