About VSC, it doesn't work well(Python, windows)

Viewed 44

When I run python code in the VSC, there's a problem.

  • When I initially run shift+enter to run each code in a particular line, it works well. However, after then that, when I try to run the overall code by using triangle button, there's a problem.
  • Same as the above, when I initially run the overall code by using triangle button, then I can't run each of code in one line with shift+enter

ex.1) When I use loop code like 'for i in range~..', the loop code works well. But when trying to do it by running the overall code, it doesn't work(specially, terminal shows that there's an indentation error. 2x.2) When I call some files on my C drive, I can call it by using shift+enter to run each code. And when I try to do it by using triangle code to make it, it doesn't work with error(invalid syntax).

(result with using shift+enter to call files)

import os
file_path = os.path.join('enron1/ham/0007.1999-12-14.farmer.ham.txt')
(result with running overall codes)
    & C:/Users/gram/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/gram/Desktop/강의/기계학습/Practice/test.py
  File "<stdin>", line 1
    & C:/Users/gram/AppData/Local/Microsoft/WindowsApps/python3.10.exe c:/Users/gram/Desktop/강의/기계학습/Practice/test.py
    ^
SyntaxError: invalid syntax

(reference) I re-installed VSC and other python files(Anaconda3) to fix this problem, it was useless.

1 Answers

File "", line 1 first you need to get out from the this triangle line(>>>) by write >>>ctrl+z then you can run your entire code .

Related