Home > Net >  Troubles in VSCode terminal because of user folder name
Troubles in VSCode terminal because of user folder name

Time:08-12

I'm new in this environment and currently learning the basics of Python through YouTube courses. While using VSCode, I always encounter the same problem when I try to use the terminal. The command (like a pip install for ex) won't run because my users folder name has a space in it. It shows "C:\User<my first name> " is not valid. Otherwise when I run code with CodeRunner everything works fine. I'm sorry to not adjoint a screenshot to it it seems I'm not able to. Is there anyway to fix this?

CodePudding user response:

You can run the command using quotes.

It'd go something like:

python "C:\Users\My User\file.py"

Using quotes should solve your issue. Cheers!

CodePudding user response:

People will probably say:

  • Don't put spaces in your paths to begin with.
  • Try updating VSCode?

If you're running the commands in the terminal, put quotes around the path. E.g., python "path/to/spaced file.py".

Otherwise, if this is a task that you're running, simply put "" around ${file} in tasks.json.

Though, I strongly recommend not using spaces, and replacing with something like - or _, or just a capitalisation rule like camelCase or PascalCase.

  • Related