Python Forum
[PyGame] "Can't perform operation for unregistered loader type" error
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] "Can't perform operation for unregistered loader type" error
#1
I've created a Game using PyGame and made an executable File using cx_Freeze. The Game works fine when its run from the Python 3.4.3 interpreter, but crashes when its run from the .exe file. The Game works fine at the startup Screen, but crashes when the button to start the Game is clicked. Here are the errors the command prompt window gives:

Error:
Fatal Python error: (pygame parachute) Segmentation Fault Traceback (most recent call last): File "C:\Python34\lib\site-packages\pygame\pkgdata.py", line 50, in           getResourc e if resource_exists(pkgname, identifier): File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 1116, in resource_exists return get_provider(package_or_requirement).has_resource(resource_name) File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 1570, in has_resource return self._has(self._fn(self.module_path, resource_name)) File "C:\Python34\lib\site-packages\pkg_resources\__init__.py", line 1625, in _has "Can't perform this operation for unregistered loader type" NotImplementedError: Can't perform this operation for unregistered loader type
 Please help me and thanks in advance.
Reply
#2
What is the source for when the button is clicked?

Since the error is referring to resources....Does the button have an image in it and how are you handling the resources with your setup.py script? Have you tried the other methods as well pyinstaller/py2exe?
Recommended Tutorials:
Reply
#3
(May-15-2017, 12:25 PM)metulburr Wrote: What is the source for when the button is clicked?

Since the error is referring to resources....Does the button have an image in it and how are you handling the resources with your setup.py script? Have you tried the other methods as well pyinstaller/py2exe?

Here is my source code:
https://github.com/ppcmdgames/NilapatriRacer

The main file containing the code is 'NilapatriRacer.py'.

I found a tutorial here and did it as in the tutorial:
https://pythonprogramming.net/pygame-pyt...t-1-intro/

 I did try py2exe and pyinstaller, but I couldn't make a working setup file. I found out this error is caused due to python not recognising the program as a package and it can be fixed by adding a file called '_init_.py', but I don't know where to add it.
Reply
#4
python2.x requires __init__.py files in all directories. They dont have to contain anything, they just need to be there. Try putting __init__.py in your sub-directories.
Recommended Tutorials:
Reply
#5
(Sep-01-2017, 12:28 PM)metulburr Wrote: python2.x requires __init__.py files in all directories. They dont have to contain anything, they just need to be there. Try putting __init__.py in your sub-directories.

I'm using Python 3.4.3 and I'm trying to add an _init_.py file in all the directories. Is there any way to copy the _init_.py file to all the other directories at once?
Reply
#6
python3.x it is optional. So you shouldnt need __init__.py files. Are you sure you are using python3.x when you are using cx_freeze?

You would just copy and paste it every directory like any other file.
Recommended Tutorials:
Reply
#7
(Sep-01-2017, 05:09 PM)metulburr Wrote: python3.x it is optional. So you shouldnt need __init__.py files. Are you sure you are using python3.x when you are using cx_freeze?

You would just copy and paste it every directory like any other file.

Yes, I'm using Python 3.4.3, pygame 1.9.2 for Python 3.4 and cx_Freeze 5.0.1 for Python 3.4.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020