oTree Forum >

Reoperationalising oTree after two years away

#1 by zwongo

Hi, I apologise if this question might seem a bit off-topic but the last I used oTree was while it was still on v3 and I have come back to it on PyCharm to try and reoperationalise a new experiment using the v5 version. 
Upon running the codes through the Python console to check coherence, I get the following error and I am not even where to begin fixing the "modulenotfound" errors. Any advice/help would be deeply appreciated!
Thanks! 

Traceback (most recent call last):
  File "D:\Core\AY2020-21\Research\oTree projects\experiment_greenmessaging\venv\lib\site-packages\otree\settings.py", line 30, in <module>
    import settings
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'settings'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 305, in do_exit
    import java.lang.System
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'java'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Core\AY2020-21\Research\oTree projects\experiment_greenmessaging\venv\lib\site-packages\otree\api.py", line 1, in <module>
    from otree.models import BaseSubsession, BaseGroup, BasePlayer  # noqa
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Core\AY2020-21\Research\oTree projects\experiment_greenmessaging\venv\lib\site-packages\otree\models\__init__.py", line 1, in <module>
    from otree.models.subsession import BaseSubsession
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Core\AY2020-21\Research\oTree projects\experiment_greenmessaging\venv\lib\site-packages\otree\models\subsession.py", line 12, in <module>
    import otree.common
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Core\AY2020-21\Research\oTree projects\experiment_greenmessaging\venv\lib\site-packages\otree\common.py", line 18, in <module>
    from otree import settings
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Core\AY2020-21\Research\oTree projects\experiment_greenmessaging\venv\lib\site-packages\otree\settings.py", line 39, in <module>
    sys.exit(msg)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 310, in do_exit
    os._exit(args[0])
TypeError: an integer is required (got type str)

#2 by gmdcastillo

Python console in PyCharm is somewhat broken with oTree 5 because PyCharm somehow assumes the project uses Django. Maybe if you start your project from scratch and copy-paste the app this error will go away. 

More concerning for me, debugging is broken and has been for a long time. I'm not sure but I'd give a lot for debugging in PyCharm to work again. Debugging with print() or breakpoint() isn't very fun.

#3 by zwongo

Thanks for your swift reply @gmdcastillo. 
I'll have a try with your work-around and report back.

That is very problematic indeed because it now becomes extremely tedious to check coherences in the Python side of the code; it currently won't read the baseconstants, and so the code further down refers to C.someconstant, it won't read that either. 

I wonder what Chris thinks.

Write a reply

Set forum username