oTree Forum >

unable to use startapp command

#1 by learningotree

Hello,

I am just learning how to use oTree, and I have an issue when trying to use the startapp command. Here is the command line output:

otree startapp multiply
Traceback (most recent call last):
  File "otree/tutorial/otree_venv/lib/python3.12/site-packages/otree/database.py", line 275, in init_orm
    models = get_models_module(app)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "otree/tutorial/otree_venv/lib/python3.12/site-packages/otree/common.py", line 75, in get_models_module
    return import_module(module_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'multiply'

I've already changed the SESSION_CONFIGS in the settings.py file as such:
SESSION_CONFIGS = [
    dict(
        name='multiply',
        num_demo_participants=10,
        app_sequence=['multiply'],
    ),
]

I am using a venv.

Thanks in advance for your help,
Jessica

#2 by BonnEconLab

I think it will work if you remove the entry that you added from the settings.py.

Try editing the settings.py file only after you have run “otree startapp multiply”.

#3 by learningotree

Hello,

Thank you so much for the speedy reply!! I only modified this because I initially got this error: 

Traceback (most recent call last):
  File "otree/tutorial/otree_venv/bin/otree", line 8, in <module>
    sys.exit(execute_from_command_line())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "otree/tutorial/otree_venv/lib/python3.12/site-packages/otree/main.py", line 108, in execute_from_command_line
    setup()
  File "otree/tutorial/otree_venv/lib/python3.12/site-packages/otree/main.py", line 132, in setup
    from otree import settings
  File "otree/tutorial/otree_venv/lib/python3.12/site-packages/otree/settings.py", line 50, in <module>
    OTREE_APPS = get_OTREE_APPS(settings.SESSION_CONFIGS)
                                ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'settings' has no attribute 'SESSION_CONFIGS'

#4 by BonnEconLab (edited )

Well, there has to be *some* SESSIONS_CONFIGS entry in the settings.py.

If I execute

otree startproject example_games

(in some suitable parent folder) and answer the question,

“Include sample games? (y or n): y”

with “y[es],” oTree generates a folder “example_games” with a settings.py file in it.

If I then execute

cd example_games

and then

otree startapp multiply

(in the “example_games” folder), everything works. After that, you can edit the settings.py and add

    dict(
        name='multiply',
        num_demo_participants=10,
        app_sequence=['multiply'],
    ),

to SESSION_CONFIGS.

Write a reply

Set forum username