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

Script requiring input #483

Closed
olawalejuwonm opened this issue May 11, 2024 · 17 comments
Closed

Script requiring input #483

olawalejuwonm opened this issue May 11, 2024 · 17 comments

Comments

@olawalejuwonm
Copy link

Thanks for the awesome project, I was able to turn my script to exe, but the script needs user input to run, I got this when i try to run the generated exe
image

@olawalejuwonm olawalejuwonm added the bug Something isn't working label May 11, 2024
Copy link

👋 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.

@brentvollebregt
Copy link
Owner

brentvollebregt commented May 12, 2024

Could you fill out the template you cleared? This will give context for me to help you.

Did you package using windowed mode (no console) - if so, how would you expect the input be entered?

@brentvollebregt brentvollebregt added question Further information is required and removed bug Something isn't working labels May 12, 2024
@olawalejuwonm
Copy link
Author

Yes I packaged using windowed mode (no console) and removed all print function.
I expect that there will be a file picker

My Environment:

  • Python version (python --version):Python 3.12.2
  • auto-py-to-exe version (pip show auto-py-to-exe): Version: 2.43.3
  • PyInstaller version (pip show pyinstaller): 6.6.0
  • Eel version (pip show eel): Version: 0.16.0

@olawalejuwonm olawalejuwonm removed their assignment May 13, 2024
@brentvollebregt
Copy link
Owner

auto-py-to-exe does not add anything extra to your application - it packages as it is. When you packaged using the windowed mode, you asked for there to be no console - this means things like print and input will no longer work by default.


In the debugging steps that was linked in the first comment on this issue, it states,

As basic as it sounds, the first step of debugging is to make sure your script works as a .py file before you package it. This is very important.

And then goes on to say,

If you are wanting to use the "Window Based" option, run your script using pythonw.exe - this executable can be found beside python.exe.

Following this, you would have had issues running your script with Python itself. If it doesn't work with Python, it won't work after packaging.

Outlined under "When running my script with pythonw.exe, it doesn't work", I show how you can redirect print elsewhere. I do not have a solution for input as you would need to build a UI for something like that.

@olawalejuwonm
Copy link
Author

How do i build such ui please?

@brentvollebregt
Copy link
Owner

Python has a built-in library called "tkinter", here is a decent tutorial. There are lots of other libraries too - search "python GUI" in Google to see what else is available.

@olawalejuwonm
Copy link
Author

olawalejuwonm commented May 14, 2024 via email

@brentvollebregt
Copy link
Owner

Yes, tkinter is just a library in Python - you will still be able to package using auto-py-to-exe afterwards.

Alternatively, you could skip needing a GUI if you're fine with providing input in the console. If so, use the console mode.

@olawalejuwonm
Copy link
Author

olawalejuwonm commented May 14, 2024 via email

@brentvollebregt
Copy link
Owner

auto-py-to-exe can be used on Mac OS. We use PyInstaller under the hood - you can check out the Mac OS support here: https://pyinstaller.org/en/v4.1/usage.html#building-mac-os-x-app-bundles

@olawalejuwonm
Copy link
Author

olawalejuwonm commented May 14, 2024 via email

@brentvollebregt
Copy link
Owner

auto-py-to-exe can build Mac OS X app bundles as described in the link I sent before

@olawalejuwonm
Copy link
Author

olawalejuwonm commented May 14, 2024 via email

@brentvollebregt
Copy link
Owner

brentvollebregt commented May 14, 2024

I've read but I don't understand how to do that, especially specifying the flag.

Use the tool on Mac OS and it will build a Mac OS App Bundle. Use windows mode and the output should then create an OS X application named [myscript].app.

Likewise, will it be possible to build for Mac on windows?

No, this is from the PyInstaller docs,

PyInstaller is tested against Windows, MacOS X, and Linux. However, it is not a cross-compiler; to make a Windows app you run PyInstaller on Windows, and to make a Linux app you run it on Linux, etc.

@olawalejuwonm
Copy link
Author

olawalejuwonm commented May 14, 2024 via email

@brentvollebregt brentvollebregt removed the question Further information is required label May 15, 2024
@olawalejuwonm
Copy link
Author

@brentvollebregt I have changed the implementation to use tkinter
But this is what I got when I try to run the file
image

@brentvollebregt
Copy link
Owner

A Google search for "pyinstaller the specified module could not be found" brings up this result which describes the same issue you have show.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants