Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to 'source' a script before launching \ debugging an application in pycharm \ intelij?

The use case is that we need some environment variable available to the applications (python \ java)

These variables are created by bash script. While the script is very simple, it does contain some logic (like handling defaults, checking some system settings, etc) - so it can't be simply replaced by static environment configuration

Is there a way in pycharm and \ or intelij to source a shell script before executing the main program?

like image 595
Ophir Yoktan Avatar asked Oct 19 '25 22:10

Ophir Yoktan


2 Answers

Specifically for pycharm, it's possible to use a script instead of a "real" python interpreter.

using a script that sets up environment and then launches the "real" python interpreter works great

something like:

#!/bin/sh
. env.sh
python "$@"

didn't find a way to do a similar thing with java

like image 129
Ophir Yoktan Avatar answered Oct 22 '25 12:10

Ophir Yoktan


No, it's not possible. Please vote for the related feature request.

There was also a similar question already asked here.

like image 23
CrazyCoder Avatar answered Oct 22 '25 11:10

CrazyCoder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!