What's the difference between running from GUI and python script?

Asked by behzad

Hey guys,

Recently, I encountered a problem in running simulations.

The thing is when we have functions in the script and we run the simulation from the user interface, it gives an error of like :

NameError: name 'loader' is not defined

Loader was a function in my model.

But, if I put the running step at the end of my python script as O.run(n,True), it runs the code with no error!

How this is happening? What's the difference between the two. Sometimes, we do not want to run the code as soon as it's created and we would like to check the parameters and see the model to ensure everything's fine and then run it.

Thanks,
Behzad

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

You may check this out: https://answers.launchpad.net/yade/+question/239546

Tell us if this applies to your case

Revision history for this message
behzad (behzad-majidi) said :
#2

Hi Jérôme,

Yeah, it seems it's the same issue. However, since variables defined in the script are supposed to be global, I'm expecting defining the things in the script and running from terminal to work, always. But it doesn't!

Thanks.

Revision history for this message
Jérôme Duriez (jduriez) said :
#3

Providing your script (shortened as much as possible) might be useful, then...

Can you help with this problem?

Provide an answer of your own, or ask behzad for more information if necessary.

To post a message you must log in.