oTree Forum >

otree startapp AssertionError

#1 by Aysegul_Engin (edited )


I'm using oTree version 5.10.2 on MacOs Ventura with a Visual Studio Code. oTree is running in a separate virtual environment.

I created an otree app using the command otree startapp new. Seemingly I have broken something. Because after this I keep getting the error for any otree startapp command. 

Traceback (most recent call last):
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/database.py", line 275, in init_orm
    models = get_models_module(app)
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/common.py", line 75, in get_models_module
    return import_module(module_name)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/Aysegul/Documents/Personal_Documents/oTree/oTree_Sync/cobam/experiment_intro/__init__.py", line 1, in <module>
    from otree.api import *
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/api.py", line 3, in <module>
    from otree.views import Page, WaitPage  # noqa
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/views/__init__.py", line 1, in <module>
    from otree.views.abstract import WaitPage, Page
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/views/abstract.py", line 18, in <module>
    import otree.bots.browser as browser_bots
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/bots/browser.py", line 7, in <module>
    from .runner import make_bots
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/bots/runner.py", line 9, in <module>
    import otree.export
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/export.py", line 14, in <module>
    from otree.common2 import TimeSpentRow, write_page_completion_buffer
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/common2.py", line 134, in <module>
    static_files_app = OTreeStaticFiles(
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/starlette/staticfiles.py", line 53, in __init__
    self.all_directories = self.get_directories(directory, packages)
  File "/Users/Aysegul/python_venv/oTree/lib/python3.11/site-packages/otree/common2.py", line 90, in get_directories
    spec is not None and spec.origin is not None
AssertionError: Package 'new' could not be found, or maybe __init__.py is missing

Things I tried: 
* Uninstalling and reinstalling oTree in the virtual environment 
* Deleting the virtual environment completely and creating the environment and installing oTree from scratch 
* Deleting whole Python 3.11 installing Python 3.11.1 and setting up the whole environment and installing oTree again. 

None of these seem to help. I would appreciate any help please. 

kind regards, 
Ayşegül Engin

#2 by Aysegul_Engin

Found my own error in settings_config. 

It seems I forgot the old app name in the session config and that was the reason for the error.

Write a reply

Set forum username