user12812532
user12812532

Reputation:

Default startup directory behavior in Dymola 2022

I just noticed an odd behavior in Dymola 2022, and I wonder if and how can I take care of it from the Python interface.

Odd behavior, because I expect Dymola to consistently set the working directory at .\Documents\Dymola at startup, unless told otherwise.

However, when I instantiate Dymola from its Python interface, at startup the working directory is set according to the setting Tools > Options > Settings > Save startup directory as follows:

One solution/fix would be to set the working directory after Dymola is instantiated, I am aware of it.

My question is rather to get an understanding of what might be going on with this behavior, and if there is a possibility to take care of it right at startup rather than afterwards

Upvotes: 0

Views: 86

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 12507

I don't know exactly what is happening with Python at the moment, but I can answer what happens inside Dymola:

  1. When you start a program from Start-Menu the current directory is as default set to the installation directory of the program (in this case Dymola).
  2. Not important: When Dymola is started it first ensures that .\Documents\Dymola exists.
  3. Not important: If the environment variable DYMOLAWORKDIRECTORY is not set it is set to .\Documents\Dymola
  4. If the current directory is the same as the installation directory of Dymola then it sets current directory to .\Documents\Dymola - otherwise it keeps the current directory. This allows you to make a short-cut "Start Dymola Here!"
  5. And then the settings where you might have changed 'Startup Directory' is processed.

But I don't know why the Python-interface changes current directory to .\project, and if you could change current directory in Python.

Upvotes: 1

Related Questions