Beginners Help - File Crossover

Question:
Wondering if anyone can help me? I made a file main.py and also a variation of that code in test.py

In test.py it has a different string to represent a variable however the is somehow a crossover between the two files and test.py does not display correctly on the console.

Anyone know what I’m doing wrong?

main.py

quantity = int(input("Just the one?"))
output: "Just the one?"

test.py

quantity = int(input(f"How many {order}s would you like?: "))
output: "Just the one?"

Hi, @ThomasTanikie, and welcome to the Replit Ask community! I think it’s because the “Run” button defaults to python main.py. To fix this, you can do one of two things:

  • run it manually
  • or change the command

Depending on which one you’d like to do, click on it:

I'd like to change the command.

To change the command, you first need to go into the .replit file (at the bottom of your files), and change:

run = "python main.py"

to

run = "python test.py"

to make sure it runs test.py instead of main.py. You should also change the entrypoint value from:

entrypoint = "main.py"

to

entrypoint = "test.py"

If you’d like to revert the action and run main.py, do it in reverse.

I'd like to run it manually.

To run it manually, open the console (or the shell) and look for the orange replit logo (or your file path in shell). From there, type in:

python test.py

which should run the file.


Hope this helps! :cowboy_hat_face:

2 Likes

Thank you so much !!! I was slowly loosing it :melting_face:

For some reason it did not make a difference when I changed the “.replit” However it ran using the shell.

Cant thank you enough! :slightly_smiling_face:

1 Like

That’s because if the interpreter field is set then you need to change the entrypointvariable.

And if you want to run the last edited file:

(click the down arrow chevron to see the full post)

4 Likes

@NoNameByProgram I believe run shouldn’t be changed. It is entrypoint that is the one controlling which file to run.
@QwertyQwerty88 Correct me if I am wrong.

There’s only one way to find ouuuuuuuuuuutttttttt…

Joking, but I did try it…
Apparently either solution works. Except for the fact that the run solution shows:

> python test.py
test
>

rather than this with entrypoint:

test
>

It’s cleaner and eaaier to read (the user, especially beginners, may get confused).

Agreed. But if it works, it works :laughing:

1 Like

not on a Repl with interpreter field set

1 Like

Huh. Works for me, even with interpreter set.

Oh. Might be a new feature of the new Python Beta template.