BashSupport Pro Run/Debug triggered for python files

Python files that run as scripts start with a hashbang line trigger the BashSupport Pro Run/Debug instead of using the built in python debugger.

Example file:

#!/usr/bin/env python3

print('hello world')

Right click on the file name tab and select “Run .py”.

This triggers the BashSupport Pro Run/Debug instead of the python one.

Is there a way to exclude python files or files with a specific hashbang line?

I’m running BashSupport Pro 2.1.2.213.

That sounds like a bug, although „debug“ should only be available for shell script files.
Is this in a file without an extension or in a .py file?
Could you also add the IDE and major version you‘re using, e.g. from Help>About?

Thanks!

I’m running

PyCharm 2021.3 (Professional Edition)
Build #PY-213.5744.248, built on November 29, 2021
Licensed to Steven Crader
Subscription is active until August 11, 2022.
Runtime version: 11.0.13+7-b1751.19 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
    debugger.watches.in.variables=false

Non-Bundled Plugins:
    com.intellij.plugins.eclipsekeymap (213.5744.3)
    com.intellij.swagger (213.5744.122)
    ru.meanmail.plugin.requirements (2022.2-2021.3)
    pro.bashsupport (2.1.2.213)

The file is called temp.py and contains the lines in the original post.

Some additional notes, if I click the green arrow next to the #!/usr/bin/env python line and select run 'temp', it runs the python binary.

image

C:\Users\steve\AppData\Local\Programs\Python\Python39\python.exe C:/Users/steve/Documents/Development/temp/temp.py
hello world

Process finished with exit code 0

If I select Run 'temp.py' from the right click menu on the file tab, it runs the BashSupport Pro step.

image

C:\WINDOWS\system32\bash.exe /mnt/c/Users/steve/Documents/Development/temp/temp.py
/mnt/c/Users/steve/Documents/Development/temp/temp.py: line 3: syntax error near unexpected token `'hello world''
/mnt/c/Users/steve/Documents/Development/temp/temp.py: line 3: `print('hello world')'

Process finished with exit code 2

Thanks for the details, that should help to get this fixed. It’s a bit unexpected that the IDE shows different run configuration actions in the gutter and on the tab title. But it should be possible to fix this.

@stevencrader This is fixed for the next update. If there’s a more specific run configuration for a file with a shebang, then that configuration will be preferred now over BashSupport Pro’s generic run configuration. That means that PyCharm’s own configuration will be shown in the context menu instead of BashSupport Pro’s configuration.

1 Like

Great! Thanks for your quick response.

@stevencrader The new update (2.1.3) is available now. Please let me know if it’s not yet working for you. Thanks!

Thanks again. I’ve verified that I don’t have the issue after the update.

1 Like