formulahendry / formulahendry/vscode-code-runner

remove quote mark in $dir

Open
#217 2 comments 13 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

When a **python project** is beyond simple, the import statement can be very complex, such as `from py_c.c_api import sample` . If PYTHONPATH is not set, there may cause ImportError.
So, Pycharm put ${fileDir} and ${WorkSpaceRoot} in PYTHONPATH before run *.py file.
For this simple file tree:

> D:/proj/
> --------foo/
>-------------foo.py

I guess the command line what pycharm use is: `"cd D:/pro/ && set PYTHONPATH=D:/pro/;D:/pro/foo/&& C:/Python27/python.exe D:/pro/foo/foo.py"`

I use these manner to run a python project in **_code-runner_**

> "code-runner.executorMap":
> "python": "cd $workspaceRoot &&set PYTHONPATH=$dir;$workspaceRoot&& C:/Python3632/python $fullFileName"

But, the variable $dir in code-runner is : `"D:/pro/foo/"` have a quote mark `"`, so it raise an ERROR. I must use some complex DOS shell snip to remove it.

> "python": "cd $workspaceRoot &set p=$dir&&set PYTHONPATH=%p:\"=%;$workspaceRoot&& C:/Python3632/python $fullFileName"

maybe remove all of quote mark in the $var string is a better design. Users can add quote mark `"` by themselves.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.