subprocess problem

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Thu Feb 9 03:09:02 EST 2017


On 09.02.2017 01:56, Andreas Paeffgen wrote:
> The Problem with the subprocess code is: Using the sourcecode
> functioning as normal.
> The frozen app with cx_freeze on every platform just returns an empty
> result
>
> Here is the code in short:
> def get_path_pandoc():
>
>
>
>
>    settings = QSettings('Pandoc', 'PanConvert')
>
>    path_pandoc = settings.value('path_pandoc','')
>
>
>
>
>    if not os.path.isfile(path_pandoc):
>
>
>
>
>        if platform.system() == 'Darwin' or os.name == 'posix':
>
>            args = ['which', 'pandoc']
>
>            p = subprocess.Popen(
>
>                args,
>
>                stdin=subprocess.PIPE,
>
>                stdout=subprocess.PIPE)
>
>
>
>
>            path_pandoc =
> str.rstrip(p.communicate(path_pandoc.encode('utf-8'))[0].decode('utf-8'))
>
>
> The whole problematic code can be checked on
> http://github.com/apaeffgen/panconvert
> in source/converters/interface_pandoc.py
>

Checking your repo I found that get_path_pandoc, the function from which 
you took the code snippet above, will always return None if 
os.path.isfile(path_pandoc).

This is probably not what you are intending. Do you know if path_pandoc 
is maybe set to an existing file in your frozen code already so the 
whole 'which' or 'where' branch is never executed?

Best,
Wolfgang




More information about the Python-list mailing list