Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The windows_curses package can no longer be bundled #132

Closed
mharbison72 opened this issue May 11, 2022 · 6 comments
Closed

The windows_curses package can no longer be bundled #132

mharbison72 opened this issue May 11, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@mharbison72
Copy link

This used to work with the original py2 releases, but fails in the py3 releases with messages like ImportError: No module named '_curses' or ImportError: Module '_curses' is in the "excludes" list, depending on the version. Bundling curses without _curses.pyd leads to an ImportError when attempting to use it.

I was able to bundle it successfully by dropping the _curses line from the exclude list here:

_curses

I'm not sure if this excludes list serves to shorten the list of missing modules printed at the end (in which case dropping the line is probably fine), or if there's more to it (and maybe the line is conditionally dropped only if windows-curses is installed).

For reference, here's the windows-curses project: https://github.com/zephyrproject-rtos/windows-curses

@albertosottile
Copy link
Member

Thanks for reporting this. As you might have noticed from blame, that code was just imported in the repository from SourceForge and never changed in the last 8 years. Hence, I do not know why _curses was explicitly added to the exclusion list. Perhaps it was not compatible with the ecosystem and the implementation of py2exe at that time.

My question for you would be: does the bundled executable that you created after commenting the _curses entry work as expected? If so, I can try to remove this module from the exclusion list, see what effect this has on the Ci, and eventually release a patch for py2exe.

@mharbison72
Copy link
Author

My question for you would be: does the bundled executable that you created after commenting the _curses entry work as expected?

It has worked fine for me with some light testing. (IDK much about curses, but the module loads and everything seems to render as it did in py2.) FWIW, I hacked around the issue in my project[1], so no rush on a release.

IDK that it matters at this point (because IDK that any of the hardcoded excludes have a 3rd party Windows module), but it might be worth restoring one of the previous messages that indicated it was in the exclude list. I had no clue what the problem was before seeing that.

[1] https://foss.heptapod.net/mercurial/tortoisehg/thg/-/blob/973a35286e80fbd39d508de6dd538e1accfb76ad/setup.py#L535

@albertosottile
Copy link
Member

but it might be worth restoring one of the previous messages that indicated it was in the exclude list.

Are you referring to this message: ImportError: Module '_curses' is in the "excludes" list ? I thought this message was printed because you mentioned it in your first post. Could you tell me which message is actually printed in 0.11.1.0 ? Thanks.

@mharbison72
Copy link
Author

but it might be worth restoring one of the previous messages that indicated it was in the exclude list.

Are you referring to this message: ImportError: Module '_curses' is in the "excludes" list ? I thought this message was printed because you mentioned it in your first post. Could you tell me which message is actually printed in 0.11.1.0 ? Thanks.

Yes, sorry for the confusion. Prior versions explicitly mentioned the exclude list in this way (and some slightly different ways, but I dump the text buffer I had with them apparently).

The current message in 0.11.1.0 is simply ImportError: No module named '_curses', which is what you'd get if something wasn't installed or similar.

albertosottile added a commit that referenced this issue Jul 3, 2022
In the end of 'ModuleFinder.find_head_package` a generic "No module
named" ImportError message is raised if a module is not found.
However, some modules are not found because they are in the `excludes`
list of the class. In this case, `mf34` used to raise a specific error
message, which is now restored by this commit.

Related: #132
@albertosottile albertosottile added bug Something isn't working and removed requires user input labels Jul 3, 2022
albertosottile added a commit that referenced this issue Jul 3, 2022
In the end of 'ModuleFinder.find_head_package` a generic "No module
named" ImportError message is raised if a module is not found.
However, some modules are not found because they are in the `excludes`
list of the class. In this case, `mf34` used to raise a specific error
message, which is now restored by this commit.

Related: #132
@albertosottile
Copy link
Member

I restored the former message in the linked commit and I will release this fix in the upcoming patch release. Thanks for reporting this.

@mharbison72
Copy link
Author

Thanks! The original report was that the curses package can't be packaged like the old py2 builds could, because it is in the exclude list. I've manually removed it from the list for TortoiseHg builds, and have had no problems with that. So it seems like it could be removed here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants