[GH-ISSUE #537] Unable to compile .pyd file to .exe – runtime error with APP keyword #412

Closed
opened 2026-02-26 12:21:31 +03:00 by kerem · 2 comments
Owner

Originally created by @Tanishq-JM on GitHub (Aug 14, 2025).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/537

Originally assigned to: @brentvollebregt on GitHub.

Describe the bug
When attempting to compile a .pyd file to an .exe application, the resulting executable fails to run and only produces the following error:

PyInstaller\hooks\rthooks\pyi_rth_pkgres.py:44: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Traceback (most recent call last):
File "app_launcher.py", line 1, in <module>
File "APP.py", line 1, in init APP
NameError: name 'exit' is not defined
[PYI-8240:ERROR] Failed to execute script 'app_launcher' due to unhandled exception!

It seems that the compiler is looking for APP.py, but the file is actually a .pyd. How do I tell the compiler to use the .pyd file instead of looking for .py?
When including the correct hookup directory in app1.json, it works, but otherwise, the same error occurs.
To Reproduce

  1. Compile a .pyd file to an .exe using auto-py-to-exe
  2. Run the generated executable
  3. Observe the error above
    Expected behavior
    The compiled executable should run the .pyd file as the main entry point, not expect a .py.
    Your Environment:
  • Python version (python --version): 3.11.8
  • auto-py-to-exe version (pip show auto-py-to-exe): latest
  • PyInstaller version (pip show pyinstaller): latest
    What I am looking for:
    I am looking for guidance on how to configure auto-py-to-exe (or PyInstaller) so that it recognizes and runs my main APP.pyd file as the entry point, instead of expecting a APP.py. Is there a specific setting, configuration, or workaround for this scenario?
    Any help or documentation reference would be appreciated.
Originally created by @Tanishq-JM on GitHub (Aug 14, 2025). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/537 Originally assigned to: @brentvollebregt on GitHub. **Describe the bug** When attempting to compile a `.pyd` file to an .exe application, the resulting executable fails to run and only produces the following error: ``` PyInstaller\hooks\rthooks\pyi_rth_pkgres.py:44: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html Traceback (most recent call last): File "app_launcher.py", line 1, in <module> File "APP.py", line 1, in init APP NameError: name 'exit' is not defined [PYI-8240:ERROR] Failed to execute script 'app_launcher' due to unhandled exception! ``` It seems that the compiler is looking for `APP.py`, but the file is actually a `.pyd`. How do I tell the compiler to use the `.pyd` file instead of looking for `.py`? When including the correct hookup directory in `app1.json`, it works, but otherwise, the same error occurs. **To Reproduce** 1. Compile a `.pyd` file to an .exe using auto-py-to-exe 2. Run the generated executable 3. Observe the error above **Expected behavior** The compiled executable should run the `.pyd` file as the main entry point, not expect a `.py`. **Your Environment:** - Python version (`python --version`): 3.11.8 - auto-py-to-exe version (`pip show auto-py-to-exe`): latest - PyInstaller version (`pip show pyinstaller`): latest **What I am looking for:** I am looking for guidance on how to configure auto-py-to-exe (or PyInstaller) so that it recognizes and runs my main APP.pyd file as the entry point, instead of expecting a APP.py. Is there a specific setting, configuration, or workaround for this scenario? Any help or documentation reference would be appreciated.
kerem 2026-02-26 12:21:31 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Aug 14, 2025):

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

<!-- gh-comment-id:3189450966 --> @github-actions[bot] commented on GitHub (Aug 14, 2025): 👋 Hi, just a reminder that if you haven't read [the help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) yet, give it a read to see if your issue is covered in it and make sure to follow [the debugging section](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging). Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help [post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/), [video](https://youtu.be/OZSZHmWSOeM) or create a [new discussion](https://github.com/brentvollebregt/auto-py-to-exe/discussions).
Author
Owner

@brentvollebregt commented on GitHub (Aug 15, 2025):

I haven't used pyd's myself directly, but I had thought they could not be run directly and needed to be imported - is this correct? So you cannot run python my.pyd?

If you cannot run it directly, I cannot imagine even PyInstaller supports this. It could be added as a binary to a script that imports it though.

<!-- gh-comment-id:3191320241 --> @brentvollebregt commented on GitHub (Aug 15, 2025): I haven't used pyd's myself directly, but I had thought they could not be run directly and needed to be imported - is this correct? So you cannot run `python my.pyd`? If you cannot run it directly, I cannot imagine even PyInstaller supports this. It could be added as a binary to a script that imports it though.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#412
No description provided.