Skip to content

Instantly share code, notes, and snippets.

@yzdann
Last active March 9, 2020 14:17
Show Gist options
  • Save yzdann/153ce6ee41729491dad8b8ab86570c27 to your computer and use it in GitHub Desktop.
Save yzdann/153ce6ee41729491dad8b8ab86570c27 to your computer and use it in GitHub Desktop.

This is my main.py.

.
.
.
try:
    cmd_type = sys.argv[1]

except IndexError:
    cmd_type = "run"

if cmd_type == "manage":
    call_command(*sys.argv[2:])

elif cmd_type == "run":
    call_command("runserver")

Here i ran command to see my migrations for django app built by shiv even this command exited successfully but with that TypeError i cannot use exit code of command. what am i missing? or what can i do for handle that?

shiv on  shiv [$?] via shiv
[I] ➜ ./myapp-1.6.3-3a380acb.pyz manage showmigrations auth
auth
 [X] 0001_initial
 [X] 0002_alter_permission_name_max_length
 [X] 0003_alter_user_email_max_length
 [X] 0004_alter_user_username_opts
 [X] 0005_alter_user_last_login_null
 [X] 0006_require_contenttypes_0002
 [X] 0007_alter_validators_add_error_messages
 [X] 0008_alter_user_username_max_length
 [X] 0009_alter_user_last_name_max_length
 [X] 0010_alter_group_name_max_length
 [X] 0011_update_proxy_permissions
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "./myapp-1.6.3-3a380acb.pyz/__main__.py", line 3, in <module>
  File "./myapp-1.6.3-3a380acb.pyz/_bootstrap/__init__.py", line 179, in bootstrap
  File "./myapp-1.6.3-3a380acb.pyz/_bootstrap/__init__.py", line 33, in run
TypeError: 'module' object is not callable

shiv on  shiv [$?] via shiv
[I] ➜ echo $?
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment