Conversation
0380177 to
7c66a53
Compare
7c66a53 to
5d67225
Compare
|
Time to rebase this one. |
…pper for _session.sendExpression()
9a285ea to
1bbe520
Compare
|
@adeas31 PR is rebased |
adeas31
left a comment
There was a problem hiding this comment.
except subprocess.TimeoutExpired: gives the following type error,
C:\OpenModelica\OMPython>python
Python 3.13.3 (tags/v3.13.3:6280bb5, Apr 8 2025, 14:47:33) [MSC v.1943 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from OMPython import OMCSessionZMQ
>>> omc = OMCSessionZMQ()
>>> omc.sendExpression("quit()")
>>> quit()
Exception ignored in: <function OMCSessionZMQ.__del__ at 0x000002873BE7C5E0>
Traceback (most recent call last):
File "C:\OpenModelica\OMPython\OMPython\OMCSession.py", line 336, in __del__
TypeError: catching classes that do not inherit from BaseException is not allowedPerhaps use only except subprocess:
|
Interesting from my look into the code it is the following class dependency: subprocess.TimeoutExpired So the error message is unexpected ... Furthermore, the following code works: ` print('START') cmd = ['sleep', '30s'] try: print('Done') It results in:
I also checked if wait() raises TimeoutExpired => Yes; see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait Tested with 3.13.3 |
|
@adeas31 could you retry with the latest commit added? I think this is not related to the main code but to the handling of the last command you did:
This stops OMC, i.e. _omc is set to None
here, the destructor of the class (=> del()) is called, which in turn calls self.sendExpression("quit()") and it fails as _omc is no longer defined I'm still not sure why TimeoutExpired is indicated as the source of the error ... |
3638961 to
ffffed1
Compare
|
Updated with a more generic approach ... |
|
@adeas31 Could it be that this is not really an error but more a python / debugger thing? I just noted that the test script (your code) runs fine if I 'run' it. Even if I stop in line 547: 'self._omc.close()' and after that run continue all is fine. Only if I do a step by step execution it fails ... Thus, the latest commit is perhaps not needed at all ... |
|
Its still the same. |
Just as Information: I'm using PyCharm and running the code in the debugger of the tool; it returns something like this
Due to this error message, I think it is not OMPython related but an error of the 'quit()' command, i.e. the closing of the debugger |
|
Yes, the OMPython code itself is correct. The message shown is expected message. Here's the relevant portion of the docs:
So what we see is expected.
True. |
rename OMCSession base as OMCSessionCmd and restructure it such that it is an independend function which contains only the API calls to OMC (was the final state of PR #270)
based on PR #270, #273, #280 and #281