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
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 ?
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 :)
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
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
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