My code is not printing in the the console window

My code is not printing in the the console window. Even it gets printed at times it prints the output of my previous code.

https://replit.com/@saxenaharsh/testfile#main.py

Screenshots, links, or other helpful context:

print("Hello")

I have looked at the .replit config file as it shows the entry as entrypoint = “main.py”

Whats going wrong here ?

Hi @saxenaharsh , welcome to the forums!
It appears that you file only contains the print() line.
Could you try entering kill 1 in the Shell?
Hope this helps!

Believe me the file contains only print(“Hello”) line and I have tried kill 1 in the shell window as well. It will reconnect probably print Hello this time on the console but if I add print(“GoodMorning”) in the same file and run again it will either not print anything for print(“Hello”). After the kill 1 now the error that I am facing is

1 Like

Try adding the line run = "python3 main.py" above the entrypoint line.

Here’s a snapshot of my .replit config file

image

Yup, add the run line above the entrypoint line.

No Luck same error

No, as in leave your entrypoint as main.py. Add a new line: run = "python3 main.py" above the entrypoint line.

Hello, added run above entrypoint line but no luck

The value should be "python3 main.py", not blank.

@saxenaharsh
Replace the entire contents with this:

run = "python3 main.py"
entrypoint = "main.py"
modules = ["python-3.10:v18-20230807-322e88b"]

[nix]
channel = "stable-23_05"

[unitTest]
language = "python3"

[gitHubImport]
requiredFiles = [".replit", "replit.nix"]

[deployment]
run = ["python3", "main.py"]
deploymentTarget = "cloudrun"

Hi, replaced the contents but no luck still the same error

This sounds like the same issue as this topic:

As a last resort here (that I don’t expect to work), could you try changing your server location in your account settings?

As a side note, this is likely also tied to the recent reports of Repls that load, but none of the files inside do. [1]


  1. ↩︎

2 Likes

I actually forked the repl, and removing the run line and changing the whole .replit file to this worked for me:

entrypoint = "main.py"
modules = ["python-3.10:v18-20230807-322e88b"]

[nix]
channel = "stable-23_05"

[unitTest]
language = "python3"

[gitHubImport]
requiredFiles = [".replit", "replit.nix"]

[deployment]
run = ["python3", "main.py"]
deploymentTarget = "cloudrun"

image

That likely won’t work for OP, check the topic I linked.

1 Like

Changing the server location didn’t work.

I didn’t expect it to, but it was worth a shot. The best I can say now is wait for Replit staff to reply here, I don’t think there’s much we can do now.

1 Like

I made another account tagged with a different email ID. Sever location is same as asia and everything works fine with this new account. So, I reckon this is a problem localised to my account.

As far as I can tell, that seems to be the case. I suppose a “workaround” for now would be to make a new account, and invite your old account to edit those Repls (or just use the new account).

2 Likes

I’m investigating this with the team, though you’re welcome to use the new account as a workaround for now.

1 Like