Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddressFile documentation #75

Closed
alustig3 opened this issue Apr 22, 2024 · 1 comment
Closed

AddressFile documentation #75

alustig3 opened this issue Apr 22, 2024 · 1 comment

Comments

@alustig3
Copy link
Contributor

I am trying to add a video feed and am having trouble with my AddressFile.
I created an my_address_file.py based on this page of documentation. A downloadable example address file would be helpful instead of the current code snippets provided in the docs.

my attempted address file has the following content:

from pybehave.Utilities import AddressFile
addresses = AddressFile()
addresses.add_component("video", "Video", "es", 0, None, {"fr": 30})

When trying to run a task I get the following error:

Exception in thread Thread-1 (update_gui):
Traceback (most recent call last):
  File "C:\Users\karpo\pybehave_eval\Lib\site-packages\pybehave\GUIs\GUI.py", line 60, in __init__
    file_globals = runpy.run_path(address_file, {"AddressFile": AddressFile})
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 286, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "C:/Users/karpo/Desktop/py-behav/Local/my_address.py", line 2, in <module>
    addresses = AddressFile()
                ^^^^^^^^^^^^^
TypeError: 'module' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\karpo\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\karpo\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\karpo\pybehave_eval\Lib\site-packages\pybehave\Workstation\Workstation.py", line 222, in update_gui
    self.guis[event.chamber] = gui(event, self.task_gui.subsurface(col * self.w, row * self.h, self.w, self.h), self)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\karpo\pybehave_eval\Lib\site-packages\pybehave\GUIs\GUI.py", line 62, in __init__
    raise MalformedAddressFileError
pybehave.Utilities.Exceptions.MalformedAddressFileError
@theonlydvr
Copy link
Contributor

So the reason this crashed is because that initial import line is unnecessary. When the AddressFile is run, the import is automatically provided. There is a GUI tool on the dev branch which streamlines the creation process somewhat if you'd like to give that a try. There's some documentation on the feature in the dev branch version of the docs.
I will add example AddressFiles to the example-tasks repo though which is also relevant to #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants