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

Error handling errors in python 3 #245

Closed
jamiebull1 opened this issue Jun 24, 2019 · 5 comments
Closed

Error handling errors in python 3 #245

jamiebull1 opened this issue Jun 24, 2019 · 5 comments
Assignees

Comments

@jamiebull1
Copy link
Collaborator

The behavior of stderr seems to have changed and it is no longer seekable. We need to write some tests for the behaviour of parse_error which should have caught this change.

@jamiebull1 jamiebull1 added the bug label Jun 24, 2019
@jamiebull1 jamiebull1 self-assigned this Jun 24, 2019
@santoshphilip
Copy link
Owner

hmm.. that was unexpected from python3

@jamiebull1
Copy link
Collaborator Author

Actually, on further testing I can't reproduce this in the test suite. I can make it happen from the command line, but not yet in a simple test. This is the issue that made me think it was a py3 change causing the failure at https://bugs.python.org/issue20074

(testEppy) C:\Users\jamie\Downloads\Share>python -m Yeppy2
* Now currect working directory is = C:\Users\jamie\Downloads\Share
Traceback (most recent call last):
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\site-packages\eppy\runner\run_functions.py", line 328, in run
    check_call(cmd, stdout=open(os.devnull, 'w'))
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:/EnergyPlusV9-1-0\\energyplus.exe', '--weather', 'C:\\Users\\jamie\\Downloads\\Share\\USA_CA_San_Francisco.epw', '--output-directory', 'C:\\Users\\jamie\\Downloads\\Share', '--idd', 'Energy+.idd', '--expandobjects', 'C:\\Users\\jamie\\Downloads\\Share\\in.idf']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\jamie\Downloads\Share\Yeppy2.py", line 15, in <module>
    idf.run(expandobjects=True, verbose="q")
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\site-packages\eppy\modeleditor.py", line 1014, in run
    run(self, weather=epw, idd=idd, **kwargs)
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\site-packages\eppy\runner\run_functions.py", line 330, in run
    message = parse_error(output_dir)
  File "C:\Users\jamie\Miniconda3\envs\testEppy\lib\site-packages\eppy\runner\run_functions.py", line 343, in parse_error
    sys.stderr.seek(0)
io.UnsupportedOperation: underlying stream is not seekable

@santoshphilip
Copy link
Owner

What is your python version ?
Your link is pointing to a version 3.3-3.4 bug.

@jamiebull1
Copy link
Collaborator Author

jamiebull1 commented Jun 24, 2019

Yeah, I'm testing on 3.7 so it's not related. It's a strange one though. From command line I get an error at the sys.stderr.seek(0) line, while running from pycharm it gets one line further before failing at sys.stderr.read(). Both on 3.7, and only when running the test script from @yahyasheikhnejad. Trying to force the same error in a test doesn't cause any unexpected behaviour.

@yahyasheikhnejad
Copy link

I do appreciate @jamiebull1 to take care of my problem.
you mentioned, "error appeared only when running the test script from @yahyasheikhnejad".
what was the problem with the code? did I miss something?
I have already tried with other IDF files and I got the same error (returned non-zero exit status 1).
it is so wired because there were also files which work well! (how could it be?!)
I am now confused with this error. (IDF file run with no error in EP-launch and all required files are provided, also there is no syntax error in the code, but idf.run() cannot be executed).

jamiebull1 pushed a commit to jamiebull1/eppy that referenced this issue Sep 14, 2019
jamiebull1 pushed a commit to jamiebull1/eppy that referenced this issue Sep 14, 2019
jamiebull1 pushed a commit to jamiebull1/eppy that referenced this issue Sep 14, 2019
jamiebull1 pushed a commit to jamiebull1/eppy that referenced this issue Sep 14, 2019
jamiebull1 pushed a commit to jamiebull1/eppy that referenced this issue Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants