Skip to content

"Run Python in Terminal" Command messes up file path #824

Closed

Description

@jrwrigh

Environment data

VS Code version: 1.20.1
Python Extension version: 2018.1.0
Python Version: 3.6.0
OS and version: Windows 10

Description

Let's say I have a file at C:\\Users\username\Documents\GitHub\Gists\Example\example.py. Selecting Run Python Script in Terminal from the Command Pallet sends command to terminal in the format python {path-to-current-file}.
However, the {path-to-current-file} doesn't have any \ and thus fails. So out example looks like this instead: c:UsersusernameDocumentsGitHubGistsExampleexample.py. Obviously the Python then comes back and says that it can't find the file.

Here's the weird part: it doesn't happen everywhere. From what I can tell, anything underneath C:\\Users\username\Documents will not work. A file in C:\\Users\username won't work either, but C:\\Users\username\Google Drive will perfectly fine.

Note that I'm currently using bash as my default terminal on Windows. I think this might have something to do with it maybe?

Output from Terminal:

$ python c:\Users\u2berggeist\Music\example.py
C:\Users\u2berggeist\Anaconda3\python.exe: can't open file 'c:Usersu2berggeistMusicexample.py': [Errno 2] No such file or directory

Activity

  1. jrwrigh commented on Feb 19, 2018

    @jrwrigh
    Author

    Everything works when I use PowerShell as the integrated terminal instead of bash. I think it might have something to do with the lack of spaces. ie. if the path has no spaces, it doesn't come up correctly in bash. If the file path does have spaces, it interprets it correctly.

  2. DonJayamanne commented on Feb 19, 2018

    @DonJayamanne

    Duplicate of #707
    Please install the Insiders Build untill we release a new version (some time end of this month).

  3. jrwrigh commented on Feb 19, 2018

    @jrwrigh
    Author

    Gotcha. Sorry for the duplicate.

  4. DonJayamanne commented on Feb 19, 2018

    @DonJayamanne

    Gotcha. Sorry for the duplicate.

    No worries. What matters is you're issue has been resolved.

  5. locked as resolved and limited conversation to collaborators on Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-terminalbugIssue identified by VS Code Team member as probable bugwindows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions