0

I want to convert the following sample python program into an executable file:

import os
print(os.getcwd())

To convert it into an executable I have used Pyinstaller:

pyinstaller app.py --onefile

And the EXE file is getting generated in the dist folder, but when I run it, it launches and immediately closes, and the expected print statement is not even displayed.

What could be the issue?

1 Answer 1

1

It does prints the statement, but just after printing it the code ends. You can add input() or use time.sleep(seconds) to make your program wait until you press a key or any particular number of seconds respectivly.

To check if your code(without the advice i have given) prints, start that python file in your command line.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.