jsfenfen/990-xml-admin

schemas.models.DoesNotExist: ProductionVersion matching query does not exist

Closed this issue · 2 comments

I got this error when I attempted to run the command: python manage.py enter_schema_files 2016v3.0

Full stack trace:
C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\db\models\base.py
:319: RuntimeWarning: Model 'returndata.skdafrm990skdaprtvi' was already registe
red. Reloading models is not advised as it can lead to inconsistencies, most not
ably with related models.
new_class.meta.apps.register_model(new_class.meta.app_label, new_class)
Entering versions: ['2016v3.0']
Walk dir c:/data/irs/990-xml-admin/schemas\source_schemas\efile990x_2016v3.0\201
6v3.0 version 2016v3.0
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\core\mana
gement_init
.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\core\mana
gement_init
.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\core\mana
gement\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\core\mana
gement\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Users\cschnaars\Desktop\Work\990-xml-admin\irs990\schemas\management
commands\enter_schema_files.py", line 60, in handle
self.walk_dir(dir, v)
File "C:\Users\cschnaars\Desktop\Work\990-xml-admin\irs990\schemas\management
commands\enter_schema_files.py", line 23, in walk_dir
this_version = ProductionVersion.objects.get(version_string=version_string)
File "C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\db\models
\manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "C:\Users\cschnaars\Envs\990-xml-admin\lib\site-packages\django\db\models
\query.py", line 380, in get
self.model._meta.object_name
schemas.models.DoesNotExist: ProductionVersion matching query does not exist.

That worked!

Both schemas_productionversion and filing_known_version_string were empty in the database. (Is there an automated/"correct" way to populate these? Nothing happened during migration.) I left filing_known_version_string empty but manually inserted the value "2016v3.0" into schemas_productionversion and made a manual change to the schemas path in my file system to match what was in the stack trace. I then ran my command again. It generated 448 rows in schemas_xsdfile.

Other than a suggestion to add instructions on how to populate schemas_productionversion and filing_known_version_string, I'm all set and am closing this issue. Thanks for the prompt reply!