code_generator ImportError: cannot import name 'generate_code'

24 views
Skip to first unread message

Jan Priebe

unread,
Jan 22, 2016, 12:56:47 PM1/22/16
to rapidsms
Hi,

I'm trying to setup the rapidsms-script app to which code_generator is a dependency (via rapidsms-polls). I've added code_generator to my project folder but when running syncdb it gives me the following error:

  File "C:\DjangoProjects\rapidsms_sandbox\code_generator\fields.py", line 14, in <module>
    from code_generator import generate_code, get_code_from_model, increment_base_10
ImportError: cannot import name 'generate_code'

Seems like this is a problem with code_generator itself, but since its a dependency for many apps someone should have picked that up by now? Any suggestions much appreciated!

Thanks,

Jan


my pip freeze in case useful:

Jan Priebe

unread,
Jan 26, 2016, 11:42:28 AM1/26/16
to rapidsms
Taking a closer look, code_generator requires you to adapt the code in code_generator.py that specifies the get_previous_code_function and the get_next_code_function, depending on which models it's being used with, so I realise my first post doesn't make much sense - sorry. I'm trying to understand where in simple_locations this code is being used so I can write the needed functions, but since I'm new to this it's taking it's time and some help would be greatly appreciated.

Could anyone who has used the rapidsms_polls app (and therefore also simple_locations and code_generator) share their adapted version of the file 'code_generator.py' ?

Muchas gracias
Reply all
Reply to author
Forward
0 new messages