os.system does not look the programs that are in my path
<p>I have a problem when calling programs inside a python script. The programs that are giving me problems are those that I have installed manually on my computer and then added them to path on .bashrc file. The programs that where installed using 'sudo apt-get install some_program' don't give me any problem</p>

<p>The programs where added to my .bashrc file as the following way:</p>

<pre><code>#path to fastqc 
export PATH=$PATH:/home/bioinfor3/bin/FastQC/
#path to fastx-toolkits
export PATH=$PATH:/home/bioinfor3/bin/fastx/
</code></pre>

<p>Inside my PyCharm, I am using the os module to call those programs the in the below manner:</p>

<pre><code>os.system('fastqc seq.fastq')
</code></pre>

<p>And I get this error</p>

<pre><code>sh: 1: fastqc: not found
</code></pre>

<p>I guess it has something to do with the sh path or something, but I am not able to make it work</p>

<p>EDIT:</p>

<p>If Pycharm is launched from the terminal, it inherits the bashrc file with my personal paths and it works</p>

<p>Presumably this is happening because you have modified your login environment to adjust your PATH, but this updated path isn't seen by the shell that's running PyCharm, or PyCharm appears to be nullifying it somehow.</p>

<p>You should first of all verify that</p>

<pre><code>os.system('/home/bioinfor3/bin/FastQC/fastqc seq.fastq')
</code></pre>

<p>operates as you would expect (no reason why it shouldn't, but worth checking).</p>

<p>It seems from <a href="http://stackoverflow.com/questions/21581197/pycharm-set-the-correct-environment-variable-path">this answer</a> that by default PyCharm doesn't use <code>bash</code> for its shell but <code>tcsh</code>. Therefore it isn't seeing the setting you are enforcing on <code>bash</code>.</p>

python bash operating-system pycharm