[solved] OpenSesame with Pygaze has a circular import in Mac.
Hello,
I have some suggestion about using OpenSeasame with Pygaze in MacOS.
Probably, I found some critical problem.
When using OpenSesame in Mac, it seems that Pygaze is imported from '/usr/local/lib/python2.7/site-packages/' even if the path of python is made to other directories.
So, there is no error (e.g., OSError: [Errno 2] No such file or directory: 'resources/fonts') after copying Pygaze into it.
Almost problem can be solved, but it may still has a different bug as below .
Traceback:
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSesame-release-3.0.2/libopensesame/inline_script.py", line 102, in run
self.experiment.python_workspace._exec(self.crun)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/OpenSesame-release-3.0.2/libopensesame/python_workspace.py", line 160, in _exec
exec(bytecode, self._globals)
File "<string>", line 6, in <module>
File "/usr/local/lib/python2.7/site-packages/pygaze/__init__.py", line 22, in <module>
from pygaze.settings import settings
File "/usr/local/lib/python2.7/site-packages/pygaze/settings.py", line 59, in <module>
settings = Settings()
File "/usr/local/lib/python2.7/site-packages/pygaze/settings.py", line 27, in __init__
from pygaze import defaults
ImportError: cannot import name defaults
It shows that Pygaze includes a circular import.
Comments
Hi,
I'm not familiar with your Python environment, but as a general tip: Python just takes the first matching thing from the Python path. In your case, this is apparently
pygaze
fromsite-packages
. If you want to use a differentpygaze
, you can either remove the one fromsite-packages
, or adjust thePYTHON_PATH
. There's a neat (hidden) trick in OpenSesame to do this. If you create a file calledenvironment.yaml
(in the working direction of OpenSesame) you can specify where OpenSesame looks for Python modules and plugins. (The custom Python path will be prepended, so it will take precedence over the existing Python path.)Where do you see a circular import?
Just as a disclaimer: You are in pretty rough territory here: PyGaze 0.6.0 is under active development, and neither Edwin nor me uses Mac OS. But it's great that you're using it, because it will help us catch bugs. But
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hello,
Thank you for your reply, and sorry for my many questions.
I am trying to make a 'environment.yaml'.
Which the 'plugins' should I use? Where should I put 'opensesame_plugins'?
There are several plugins folder; plugins in Pygaze and in OpenSesame.
Best,
The plugins that are bundled with PyGaze (in the folder
opensesame_plugins
) need to be somewhere OpenSesame can find them. To do so, you can add that folder (the full path toopensesame_plugins
to the OPENSESAME_PLUGIN_PATH). Something like:Does that make sense?
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hello sebastiaan,
I added the path to OPENSESAME_PLUGIN_PATH, but I was not able to open Pygaze eye-tracking template in OpenSeasame because the error occurred when I tried to open it.
I already changed the codes of 'pygaze_init.py'; from dummy to Eyelink.
Should I change any other setting?
Best
Hello sebastiaan,
I succeeded to use OpenSeasame with Pygaze in MacOS!
I needed to move the plugins ('pygaze_init', 'pygaze_log'...) to '/opensesame/plugins'.
It doesn't work when I moved it to other plugins directories.
Next, I try to use Pygaze in Expyriment script.
How can I do that?
Is it possible to add pygaze functions to my script of Expyriment, and copy it in the 'inline_script'?
Best,
Hello,
I was able to do the eye tracking!
Pygaze functions (e.g., eyetracker....()) on 'inline_script' worked fine.
Thank you very much for your kind advice.
I hope this helps for all user of MacOS.
Best,
Good to hear!
Check out SigmundAI.eu for our OpenSesame AI assistant!