Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting processing errors #10

Closed
michaelaye opened this issue Jun 12, 2015 · 4 comments
Closed

Getting processing errors #10

michaelaye opened this issue Jun 12, 2015 · 4 comments

Comments

@michaelaye
Copy link
Contributor

Is there a way to get the original error message from a ProcessError?
So far I only get this:

---------------------------------------------------------------------------
ProcessError                              Traceback (most recent call last)
<ipython-input-24-66f5816a1e13> in <module>()
----> 1 process_fname(merged.fpath.iloc[0])

/Users/klay6683/Dropbox/src/p4terrains/CTX_processing/calibration.py in process_fname(fname, get_name_only, keep_all, overwrite)
     25     print('making ISIS cub')
     26     stdout.flush()
---> 27     mroctx2isis(from_=fname, to=cub_name)
     28     print('spice init')
     29     stdout.flush()

/Users/klay6683/miniconda3/lib/python3.4/site-packages/pysis-0.5.1-py3.4.egg/pysis/isiscommand.py in __call__(self, **kwargs)
     55 
     56     def __call__(self, **kwargs):
---> 57         return self.call(**kwargs)
     58 
     59 

/Users/klay6683/miniconda3/lib/python3.4/site-packages/pysis-0.5.1-py3.4.egg/pysis/isiscommand.py in call(self, **kwargs)
     47         retcode = process.poll()
     48         if retcode:
---> 49             raise ProcessError(retcode, cmd, stdout=output, stderr=err)
     50 
     51         return output

ProcessError: Command '/Volumes/Data/Applications/ISIS3/isis/bin/mroctx2isis' returned non-zero exit status 4

Would be good if the causing problem could be caught in Python somehow. In this case it was:

mroctx2isis: Importing
**I/O ERROR** Cannot read file [./D14_032666_0916_XN_88S350W.IMG]. Position [19121830]. Byte 
count [5000].
@wtolson
Copy link
Owner

wtolson commented Jun 12, 2015

Yep, the stdout and stderr of the process is attached to the exception thrown. You can do something similar to this to print them out:

try:
    mroctx2isis(from_=fname, to=cub_name)
except ProcessError as error:
    print(error.stdout)
    print(error.stderr)

@michaelaye
Copy link
Contributor Author

Thanks!

@michaelaye
Copy link
Contributor Author

Should I add this to the readme maybe?

@wtolson
Copy link
Owner

wtolson commented Oct 30, 2015

Yeah, that would be really nice to have in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants