You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering this when I call marx through from Python through subprocess.run. I don't think it's Python specific and I can probably use shell constructs, too, to trigger the same behavior, but I'm just going to stick with the "Calling from Python" here as an example.
I noticed that MARX fails with stdin is NOT a tty. is certain parameters are passed. Most parameters are fine, but a certain subset of them triggers this, if marx is not called from a shell, e.g.: subprocess.run(['marx', 'SpectrumType="FILE"', 'SpectrumFile=abspowerlaw.spec').
It works fine, if there is no SpectrumFile parameters. Tracing around the code a bit, it comes down to _pf_query_current_value in pfquery.c which is triggered for reading from parameters in marx.par that are of type "f" (file). Note, that this does not apply to fits files (e.g. the ASPSOL file), which are read as parameter type "string" and then that file name string is passed to jdfits. However, text files are read with the pfiles modules that's part of marx which triggers this.
While the pfiles module is written to require a TTY, I don't see fundamentally why it has to be. On the other hand, I'm somewhat reluctant to change the C implementation of something that works for just a tiny bit on increased convenience for calling marx from Python.
For my immediate use case, I can work around that by changing the syntax slightly and passing it all to a new shell: subprocess.run(['marx SpectrumType="FILE" SpectrumFile=abspowerlaw.spec'], shell=True).
The text was updated successfully, but these errors were encountered:
I'm encountering this when I call marx through from Python through
subprocess.run
. I don't think it's Python specific and I can probably use shell constructs, too, to trigger the same behavior, but I'm just going to stick with the "Calling from Python" here as an example.I noticed that MARX fails with
stdin is NOT a tty.
is certain parameters are passed. Most parameters are fine, but a certain subset of them triggers this, if marx is not called from a shell, e.g.:subprocess.run(['marx', 'SpectrumType="FILE"', 'SpectrumFile=abspowerlaw.spec')
.It works fine, if there is no
SpectrumFile
parameters. Tracing around the code a bit, it comes down to_pf_query_current_value
inpfquery.c
which is triggered for reading from parameters inmarx.par
that are of type "f" (file). Note, that this does not apply to fits files (e.g. the ASPSOL file), which are read as parameter type "string" and then that file name string is passed to jdfits. However, text files are read with the pfiles modules that's part of marx which triggers this.While the pfiles module is written to require a TTY, I don't see fundamentally why it has to be. On the other hand, I'm somewhat reluctant to change the C implementation of something that works for just a tiny bit on increased convenience for calling marx from Python.
For my immediate use case, I can work around that by changing the syntax slightly and passing it all to a new shell:
subprocess.run(['marx SpectrumType="FILE" SpectrumFile=abspowerlaw.spec'], shell=True)
.The text was updated successfully, but these errors were encountered: