How do I run a compiled .pyc python script with Replit

Hello, I am new to replit and I have been trying to figure out how to run my compiled python script which is .pyc format. I will love to be able to run the command ’ Python3 nameoffile.pyc

Did you try setting run command in .replit file?
If you did not, here’s how to do it:

  1. Create a file and name it .replit.
  2. Add the following line in the file:
run = [ "nameoffile.pyc"]

No need to create a .replit file,just create a python repl and then click on the three points, select show hidden files and scroll down through the files and you will find the .replit file. Then change the code to :

run = "python3 nameoffile.pyc"
2 Likes

@Hugo, So does creating .replit file not work anymore or is it just an alternative?

it’s an alternative!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.