Exe file (by Setuptools) doesn't run (for reasons unknown)

libraries imported for game:

from direct.showbase.ShowBase import ShowBase
from random import randrange
from panda3d.core import *
from direct.task import Task
from math import sin, cos, pi 
from direct.gui.DirectGui import *
from direct.gui.OnscreenText import OnscreenText
from direct.gui.OnscreenImage import OnscreenImage

Setup.py:

from setuptools import setup
setup(name="Shiny Star", 
     options = {'build_apps': 
	     {"include_patterns" : 
              ['models/stars.jpg', 
		       'models/asteroid.jpg', 
		       'models/8k_terra.jpg', 
		       'models/8k_mars.jpg', 
		       'models/8k_jupiter.jpg', 
		       'models/8k_sun.jpg', 
		       'models/8k_mercury.jpg', 
		       'models/8k_venus.jpg', 
		       'models/8k_uranus.jpg', 
		       'models/8k_uranus_ring.jpg', 
		       'models/8k_neptune.jpg', 
               'models/8k_saturn.jpg', 
               'models/8k_saturn_ring.jpg', 
               'models/Amongst_The_Stars.mp3', 
               'models/Asteroid.bam', 
               'models/Ring.bam', 
               'models/Planet.bam', 
               'models/Sun.bam', 
               'models/Plane.bam'], 
         'include_modules' : 
             ['math', 'random'],
         'gui_apps': {'Shiny Star': 'SSS.py'}, 
         'platforms': ['win_amd64'],
         'plugins': ['pandagl', 'p3ffmpeg', 'p3ptloader']
        }
    }
)
	

requirements.txt:

panda3d

I checked every model and texture, they are in the folder they are supposed to be in.
So i don’t understand why the exe doesn’t work.
Any ideas?

I might suggest either:

  • Specifying a log-file, then looking at the resultant log-file, or
  • (Temporarily) changing the built program to be a “console” app (i.e. swapping “gui_apps” for “console_apps”), and then running it in the console/terminal/cmd and looking at the resultant console-output.

That might provide some information on the matter!

Tried your second suggestion:

Traceback (most recent call last):
  File "importlib._bootstrap_external", line 1346, in _path_importer_cache
KeyError: 'c:\\Python38\\build\\win_amd64'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "__main__", line 136, in <module>
  File "__main__", line 11, in __init__
  File "direct.showbase.ShowBase", line 179, in __init__
  File "direct.showbase.ShowBase", line 546, in __setupProfile
  File "importlib", line 127, in import_module
  File "importlib._bootstrap", line 1014, in _gcd_import
  File "importlib._bootstrap", line 991, in _find_and_load
  File "importlib._bootstrap", line 971, in _find_and_load_unlocked
  File "importlib._bootstrap", line 914, in _find_spec
  File "importlib._bootstrap_external", line 1407, in find_spec
  File "importlib._bootstrap_external", line 1376, in _get_spec
  File "importlib._bootstrap_external", line 1348, in _path_importer_cache
  File "importlib._bootstrap_external", line 1324, in _path_hooks
  File "importlib._bootstrap_external", line 1594, in path_hook_for_FileFinder
  File "importlib._bootstrap_external", line 1469, in __init__
  File "importlib._bootstrap_external", line 171, in _path_isabs
AttributeError: module 'nt' has no attribute '_path_splitroot'

I don’t understand what happened…

At the least we have a lead!

Have you searched the forum for others who have had similar problems? I think that there have been some such.

Searched for it. There are some with problems with setuptools exe files, but they are not like mine. That’s the first thing I do before I post, and I have checked it again, nothing similar.

Looking around, this post and the one after seems to indicate that there’s a potential issue with certain versions of Python that can cause symptoms like these–could the same issue be the problem here?

Maybe, I use Python 3.8.10.
So, according to the posts, I have to change to Python 3.7?

I’m afraid that it’s not an issue that I’m familiar with, and so I fear that I’m not in a position to say much beyond what’s already posted there. :/

I understand, anyway, thank you for your help. I’ll try to switch to another version.

1 Like

It worked! Thank you!

1 Like

I’m glad, and it’s my pleasure! :slight_smile:

1 Like

Yeah, this was an issue introduced by recent point releases to Python (i.e., I think earlier versions of 3.8 might work if you want 3.8 features).

I’d also like to point out a few things about cleaning up your setup.py:

include_patterns supports globbing:

options = {
  'build_apps': {
    ...
    'include_patterns': [
      'models/*.jpg',
      'models/*.mp3',
      'models/*.bam'
    ]
  }
}

If you just want everything in the models directory, you can use models/**.

Also, if you are not running into issues with build_apps failing to pick up math or random, you do not need to explicitly list them in include_models. build_apps should find these automatically, and you only need to add additional include_modules if build_apps missed something (usually only happens with things like dynamic imports).

Lastly, you might want to double-check your plugins. p3ffmpeg is pretty large, and if you do not need the extra formats it supports, then I would suggest not using it. I believe Panda can handle JPEG without FFMPEG, but I don’t think it can do MP3. However, it can do OGG without FFMPEG, so you might want to consider using that instead. p3ptloader is only needed if you are planning to load EGG files.

2 Likes

For the record, the issue with Python 3.8 was resolved in Panda3D 1.10.10.

2 Likes