Python: Bash Syntax Error

Question:
I am taking my first steps into python, and I was successful in getting a print("hello, world") to display as it should in the main.py. When attempting to do print("Hello") through the Console tab I continuously get the following error.

bash: syntax error near unexpected token "hello"

This is a brand new file using the Python Template. The only addition I have made to the .replit file is the run = "clear && python3 main.py" to get ride of the extra stuff that loads in the console each time.

I wasn’t familiar with the best wording earlier to determine if a thread was already open regarding this. I found a thread that is now linked below. :slight_smile:

https://ask.replit.com/t/unable-to-call-python-functions-from-console/66268?u=scottdawebguy

In the new python template, you can’t directly use python in the console tab as it defaults to the Linux Command Line (bash).

The course I am using just says use the Python Template. Is there another template that would recognize Python in the console window?

Thanks,

I am aware that replit has recently been tinkering with their python template and subsequently removing the ability to run python in the console. I recommend making a feature request to bring back prybar-python, which the package which allows you to run python in the console. You can make a feature request by creating a new topic and setting the Category to Feature Requests.

2 Likes

You can always run python in the shell or console by first typing in python. However, it will be a new, “blank” session every time you start it.

1 Like

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