3

I try to launch an Abaqus job from a Python script:

subprocess.call(['/opt/Abaqus/Commands/abq6132', 'job=test.inp'])

The following warning message appears as expected:

Abaqus Warning: The .inp or .sim extension has been removed from the job identifier

also, the .com file is created, and an empty .log file is created. But then nothing else happens, and abaqus pre and standard do not start.

Trying to start other software with subprocess.call() works quite well, e.g. launch Matlab; only Abaqus is not starting as expected. Does Anyone have an idea why it is not working with Abaqus?

Btw, also other possibilities, e.g. subprocess.call(['/opt/Abaqus/Commands/abq6132 job=test.inp'], shell=True) give the same results.

UlrichH
  • 83
  • 6
  • you want just `job=test` – agentp Jan 17 '17 at 11:27
  • that's not changing anything... Anyway, in the meantime I discovered that it's working when launched from the command window, but not when launched from inside eclipse – UlrichH Jan 17 '17 at 12:37
  • probably, the problem is similar to: http://stackoverflow.com/questions/3460130/subprocess-popen-has-inconsistent-behavior-between-eclipse-pycharm-and-termina ... (path variables in IDE) however, I still don't know how o fix the problem – UlrichH Jan 17 '17 at 12:52
  • getting rid of the `inp` should kill the warning about needing to remove it! I guess that wasn't really the core problem though. – agentp Jan 17 '17 at 17:54

1 Answers1

4

Finally I found a solution for this problem in:

Abaqus-Python misbehavior

To solve the problem, a certain environment variable needs to be removed:

    import os
    try:
        os.environ.pop('PYTHONIOENCODING')
    except KeyError:
        pass
    subprocess.call(['/opt/Abaqus/Commands/abq6132 job=test.inp'], shell=True)
Community
  • 1
  • 1
UlrichH
  • 83
  • 6
  • Amazing. I had a problem that I could not issue suspend and resume commands to Abaqus through python. Your solution completely solved it! – UN4 Feb 06 '17 at 14:27