oTree Forum >

Error when trying to resetdb for Heroku deployment

#1 by jtku

Dear Otree community,

I'm trying to deploy my project through heroku and I keep running into an error on the resetdb step. My project reads a csv that is in the files for values and there seems to be something problematic in the file path. It runs properly locally (on my windows device), but I get the following error when I resetdb. 

I've tried changing from forward to backslashes and with and without the "r" in the file path. I've also checked that the csv file indeed exists where I have in on the heroku server.

Of note is also that in the FileNotFoundError, an extra backslash is inserted that I don't know the origin of.


The error log is the following:

Starting process with command `otree resetdb --noinput`
 State changed from starting to up
 Traceback (most recent call last):
   File "/app/.heroku/python/lib/python3.9/site-packages/otree/database.py", line 275, in init_orm
     models = get_models_module(app)
   File "/app/.heroku/python/lib/python3.9/site-packages/otree/common.py", line 75, in get_models_module
     return import_module(module_name)
   File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
   File "", line 1030, in _gcd_import
   File "", line 1007, in _find_and_load
   File "", line 986, in _find_and_load_unlocked
   File "", line 680, in _load_unlocked
   File "", line 850, in exec_module
   File "", line 228, in _call_with_frames_removed
   File "/app/infoBias_practice/__init__.py", line 22, in 
     class C(BaseConstants):
   File "/app/infoBias_practice/__init__.py", line 52, in C
     PRACTICE_ROUND_CHOICES = get_round_choices_from_csv(r'infoBias_practice\practice_round_vals.csv')
   File "/app/infoBias_practice/__init__.py", line 15, in get_round_choices_from_csv
     with open(filepath, newline='') as csvfile:
 FileNotFoundError: [Errno 2] No such file or directory: 'infoBias_practice\\practice_round_vals.csv'
 Process exited with status 1
 State changed from up to complete
 
 
 Best,
 
 jtku

#2 by Chris_oTree

What error do you get when you use a forward slash?

#3 by jtku

I just retried the process again, it seems like the combination of with the r and forward slash worked (and posting about it). Thanks again!

Write a reply

Set forum username