Problem description:
I tell the shell to run main.pyc
but it says that main.pyc
doesn’t exist even though it does.
Expected behavior:
main.pyc
runs and Bash works
Actual behavior:
It says “main.pyc not found”
Steps to reproduce:
- compile Python code (using Python)
- try to run
main.pyc
Bug appears at this link:
https://replit.com/@SnakeyKing/machine-code#.replit
try running ls
in the console and showing us the output. Did you mean to look in the __pycache__ directory?I visited your repl, and main.pyc is indeed in the “home” dir.
Is main.pyc supposed to be an executable? Perhaps you need to run with a C interpreter?
@SnakeyKing I just found out, although main.pyc might look like an executable, you still need to run it with Python.
./main.pyc # Error
python main.pyc # Shows Hello World!
To compile Python code into an executable, try using pyinstaller:
pyinstaller --clean --onefile --distpath ./ main.py -n myProgram
./myProgram # Hello World!
Perhaps change category to Code Help
3 Likes
[1270] Cannot open PyInstaller archive from executable (/home/runner/py-to-mc/build) or external archive (/home/runner/py-to-mc/build.pkg)
(btw I did build
instead of myProgram
)
@SnakeyKing Try using a name other than build
, as pyinstaller creates a temporary directory called build
to build the executable.
EDIT: It seems that pyinstaller is not supported by Replit (GLIBC issues).