I'm working through some Panda3D tutorials and have created a few simple programs. At some point in the near future, I would like to be able to bundle my Panda3D program into a standalone application using PyInstaller.
However, I'm experiencing a strange issue even with the simplest program.
I've used the command `pyinstaller -F -c -w 01\ –\ blank\ window.py`.
It works as normal and creates a Unix executable and a macOS .app file in the `dist` folder. However, neither of them work, they just open and close immediately. After some research, I found the source of the problem.
When I run either executable from Terminal, I get this error:
Traceback (most recent call last):
File "01 – blank window.py", line 1, in <module>
from direct.showbase.ShowBase import ShowBase
ModuleNotFoundError: No module named 'direct'
[29403] Failed to execute script 01 – blank window
I don't know why this error is occurring, given that my programs work perfectly fine when using `python3 01\ –\ blank\ window.py` or running straight from VS Code.
>How can I fix the above error?
**Specs:**
macOS 10.14.6 (Mojave)
My system has Python 2.7 (comes with macOS) and Python 3.7. I always use Python 3.7. Though I'm not sure what version of Python I'm using with Panda3D, since the SDK comes with its own version.
Panda3D 1.10.4.1
The `direct` module is at `/Developer/Panda3D/direct` and my `PATH` is `/Library/Frameworks/Python.framework/Versions/3.7/bin://anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/akaash_home/Library/Python/3.7/bin:/Developer/Panda3D/bin:/Developer/Panda3D`
Also, I wonder if it makes a difference that I'm running these files off an external hard drive and I'm using PyInstaller to put the app on the same drive.
**EDIT:**
I've also tried adding the option `--hidden-import=direct` but it makes no difference.