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

System state isn't restored after loading failure (FileNotFoundError) #54

Closed
ragonneau opened this issue Mar 28, 2023 · 2 comments · Fixed by #55
Closed

System state isn't restored after loading failure (FileNotFoundError) #54

ragonneau opened this issue Mar 28, 2023 · 2 comments · Fixed by #55
Assignees
Labels
bug Something isn't working

Comments

@ragonneau
Copy link
Contributor

Describe the bug
Failures may happen when loading problems. However, the previous state of the system, and in particular the current working directory, is not restored. See the example below

To Reproduce

import os, pycutest

try:
    prob = pycutest.import_problem('SCURLY20', sifParams={'N': 10})
except RuntimeError:
    print("Loading failed.")
print(os.getcwd())

This code returns the following error.

 Problem name: SCURLY20

 Double precision version will be formed

 ** Exit from INTERPRET_gpsmps - index parameter name S-9        not recognised 

 From within do loop ending on line    68, current line is 
  ZN Q-9       X-9         0.0000D+00   S-9         0.0000D+00

 Return from INTERPRET_gpsmps, status = 3
 Decoding failure, status = 3

 ERROR: Error exit from decoding stage. terminating execution.


Loading failed.
Traceback (most recent call last):
  File "mytest.py", line 8, in <module>
    print(os.getcwd())
FileNotFoundError: [Errno 2] No such file or directory
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 76, in apport_excepthook
    binary = os.path.realpath(os.path.join(os.getcwd(), sys.argv[0]))
FileNotFoundError: [Errno 2] No such file or directory

Original exception was:
Traceback (most recent call last):
  File "mytest.py", line 8, in <module>
    print(os.getcwd())
FileNotFoundError: [Errno 2] No such file or directory

Information about your installation:

  • Operating System: Ubuntu 20.04.6 LTS
  • Python Version / Distribution: Python 3.8.10
  • PyCUTEst Version: 1.5
@ragonneau ragonneau added the bug Something isn't working label Mar 28, 2023
@ragonneau ragonneau changed the title System state isn't restored after loading failure (FileNotFoundError ) System state isn't restored after loading failure (FileNotFoundError) Mar 28, 2023
@jfowkes jfowkes self-assigned this Mar 28, 2023
@jfowkes
Copy link
Owner

jfowkes commented Mar 28, 2023

Thanks @ragonneau, looks like we need to handle decoding errors from SIFDecode more gracefully and restore the current working directory on exit. I will investigate.

@ragonneau
Copy link
Contributor Author

Hi @jfowkes,

It's what I think, but I am not familiar with the code structure of PyCUTEst. I believe you'd patch the problem much faster than I would :-)

Thanks,
Tom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants