question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use shebang to override pythonPath on a per-file basis

See original GitHub issue

I have a collection of scripts in various languages which have no file extensions but have the appropriate shebangs, including a mix of #!/usr/bin/env python and #!/usr/bin/env python3 files in the same directory. VSCode already successfully detects the language, but the Python extension always uses the interpreter set in pythonPath, resulting in some of the files reporting errors that don’t actually apply. Ideally, the Python extension would resolve the shebang to determine the correct interpreter to use for that file so that users don’t have to manually switch back and forth.

This was previously discussed in #497, and it was stated that this was a choice made by design to avoid possible issues. I think that’s a perfectly reasonable position for default behavior, but it would be nice to have the option to enable shebang support.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Dec 14, 2018

Sorry about that

0reactions
DonJayamannecommented, Dec 14, 2018

Fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does shebang overwrite the python interpreter path
No. It is only used if you make your python file executable and run directly ./test.py. As it is being read and used...
Read more >
Why is it better to use "#!/usr/bin/env NAME" instead of "#!/path ...
In tutorials (on Python, for example), there seems to be a suggestion that the latter shebang is better. But, I don't quite understand...
Read more >
Python Setup and Usage
Ignore all PYTHON* environment variables, e.g. PYTHONPATH and ... Skip the first line of the source, allowing use of non-Unix forms of #!cmd ......
Read more >
Python import: Advanced Techniques and Tips
In this tutorial, you'll learn how to: Use modules, packages, and namespace packages; Handle resources and data files inside your packages; Import modules ......
Read more >
GIS/MEA 584: Mapping and Analysis Using UAS - GitHub Pages
First, start GRASS GIS in the Mapset you will be using for the assignment. ... have the lidar tiles, download them using Python,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found