Issue in running the script "twice" #1362
Replies: 3 comments 25 replies
-
I think when building the model, we would rarely write something, only when we are getting the output data. If we do this, much of the code will not be executed in python 3 interpreter, what if we want to do some debugging in python 3 to see what is in the model, though it is different in the abaqus python 2 interpreter, we can still get some information about the model. |
Beta Was this translation helpful? Give feedback.
-
I was think about to move all the calls of the
...
gettrace = getattr(sys, 'gettrace', None)
exit_after = False
if gettrace is None or not gettrace():
exit_after = True
abqpy.abaqus.run(cae=True, exit_after=exit_after)
...
gettrace = getattr(sys, 'gettrace', None)
exit_after = False
if gettrace is None or not gettrace():
exit_after = True
abqpy.abaqus.run(cae=False, exit_after=exit_after) In this way, both What do you think? |
Beta Was this translation helpful? Give feedback.
-
Implemented in #1501. |
Beta Was this translation helpful? Give feedback.
-
Some times, there will be found another issue regarding the place where the
run()
function is called.Imagine the following situation:
In the above code, the
run()
function is called in themdb.saveAs()
method, which launches Abaqus and exit.Because of that, if
mdb.saveAs()
is called at the end, the "code stuff" will run twice: by thepython3
interpreter (with the command linepython3 script.py
) and by theabaqus python2
interpreter. And that could cause some issues in operations like writing files and moving folders.One possible solution is:
Move the call of
run()
function to the modulesabaqus
andodbAcess
.When we
import abaqus
orimport odbAcess
, the function will launch Abaqus and exit, not running the "code stuff" inpython3
interpreterIs that feasible?
Beta Was this translation helpful? Give feedback.
All reactions