Help (beginners stuff) - Replit - bash: [name of the variable]: comand not found

Dear all,
utter beginner here.
Programming environment: Replit

My code (ahum…) ran smoothly for two days.
In a way it stil does, but I can no longer use the CLI as I used to.
For instance: when I call the current value of a variable, I get the following error message:

“bash: [name of the variable]: comand not found”.

What’s going on here?

Hoi Jos,

bash is an OS command shell. When you run

python $file

it only runs that script once, then exits back to the OS shell!
Try just running python and then inside the python interpreter, run:

import main

(Note that needs to be in your current directory or somehow findable on the PYTHONPATH else you’ll get a ModuleNotFoundError.)

Look at the tabs for the right-hand window. See how “Console” is highlighted? This is a place where Replit simulates what a terminal window on your computer would do: a place where you can run programs, navigate through folders etc. (But it looks like it’s pretending to be a computer that runs Linux; if you use Windows then this will not be familiar to you.) I don’t use the Replit website at all, so I’m not really sure why they have a feature like this; it’s probably very limited.

If you click the “Shell” tab, it should give you the place where you can type Python code and have it interpreted one statement at a time, instead. Unfortunately, the terms used here are not very standardized. I can easily argue for applying them the other way around, even.

But in the long run, I would recommend learning the following skills, that I consider fundamental:

  1. Install Python locally (Linux and Mac computers will generally come with a version of Python already installed, but it’s better if you learn about this anyway; you can get a more up-to-date version, and the “system Python” is often protected against changes for security reasons)

  2. Understand terminal/command-line windows, and the command syntax for them

  3. Understand that the command line can be scripted, and pick up some basics (for Windows, this means “batch files” that normally have a .bat extension. For Linux and Mac, this means using some kind of “shell” language; there are many options; the most popular/default is “bash”, and the most bare-bones is “sh”)

  4. Edit Python source code in a text editor (you can use a proper IDE if you want, but it’s not necessary at all, and I think a plain text editor helps focus on learning the language and the editor individually)

  5. Run Python code at the command line

  6. Use the command line to make virtual environments for Python, and understand what that entails

  7. Learn the basics of a source control system, such as Git, to keep track of changes to source code and have a way to undo larger mistakes

1 Like

What kind of limitation are you thinking of?

I’ve for example used it to run top, to pip-install some module that they didn’t install automatically (they usually do), and to download files from the web with wget.

Dangit they broke it ~2 days ago. “Console” indeed used to let you enter Python, but not anymore. And “Shell” was and still is bash.

I don’t think it’s pretending.

Oh, hmm. So then they actually virtualize an entire machine to host their web-app IDE? That seems… generous.

Maybe they have enough paying users (I’m one).

I like it a lot, btw. Good for safely playing around with code from Stack Overflow questions or so when people are using third-party packages. Replit auto-installs pretty much everything you import. I don’t know any other sites where you can use third-party packages. Their Android app also works quite well. (All that is available in the free version as well, I’m just paying to have private repls and to have more speed.)