Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Variable containing object is not defined in console

Hi,

I sometimes use the Jupyter QtConsole integrated in OpenSesame to debug my code, and I noticed that some variables that should be accessible were indicated as "not defined" by the console (see screenshot capture below).

After a few tries, I realized that the variables that the console didn't find were always variables containing an object, like a canvas, or an object of a custom class as simple as the one below.

class MyObject():
    num = 1

myObj = MyObject()

You will find attached a minimal example to reproduce the problem.

Is this a bug, or is there a reason for this?

Thanks for your help.

Best,

Jessica


Comments

  • Sorry, I forgot the parentheses in the class defined in my first post :

    myObj = MyObject()
    

    The code defined in my minimal example is correct.

  • Hi @Jessica Bourgin ,

    That can happen, yes. The experiment runs in a separate Python process, which you cannot directly access through the console. To nevertheless allow for basic debugging, variables are explicitly copied from the experiment process to the console process. But that doesn't work for every type of variables.

    Does that clear things up? I realize this limits the usefulness of the console for debugging.

    — Sebastiaan

  • Hi @sebastiaan ,

    Thanks a lot for your answer. Yes, I understand now :-)

    Best,

    Jessica

Sign In or Register to comment.