Django AttributeError: 'getfullargspec' object has no attribute 'default' - python

I teared down Django-oscar for practice and rebuild it not in capacity of a plugin app but as Django project. Now I am having this issue but couldn't figure out what it is related to exactly. Can someone help me to resolve this?
Following is the error I am getting:
When I run command "python manage.py shell" I get this error.
(supermarket) C:\Users\shazia\supermarket\market>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 354, in execute_from_command_line
utility.execute()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 445, in execute
output = self.handle(*args, **options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 58, in run_shell
return getattr(self, shell)()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 41, in ipython
ip()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 34, in _ipython
from IPython import start_ipython
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\__init__.py", li
ne 47, in <module>
from .core.application import Application
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\core\application
.py", line 22, in <module>
from traitlets.config.application import Application, catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\__init_
_.py", line 6, in <module>
from .application import *
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 120, in <module>
class Application(SingletonConfigurable):
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 291, in Application
def initialize(self, argv=None):
File "<decorator-gen-1>", line 2, in catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 232,
in decorate
evaldict, __wrapped__=func)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 219,
in create
self = cls(func, name, signature, defaults, doc, module)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 109,
in __init__
setattr(self, a, getattr(argspec, a))
AttributeError: 'getfullargspec' object has no attribute 'default'

You are on Windows as per the error description. Use 'manage.py shell' instead of 'python manage.py shell'.

Related

How to fix 'ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_ulong instance instead of LP_SECURITY_ATTRIBUTES'

I'm trying to open IPython shell by running the command python manage.pyshell for django project but I'm not getting the expected output. Instead, I'm getting some weird stuff.
I tried running twice but the same thing is happening again and again.
And the error I'm receiving
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "c:\users\khyati\django\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "c:\users\khyati\django\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\users\khyati\django\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "c:\users\khyati\django\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "c:\users\khyati\django\django\core\management\commands\shell.py", line 99, in handle
return getattr(self, shell)(options)
File "c:\users\khyati\django\django\core\management\commands\shell.py", line 36, in ipython
start_ipython(argv=[])
File "C:\Users\khyati\Anaconda3\lib\site-packages\IPython\__init__.py", line 125, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "C:\Users\khyati\Anaconda3\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-113>", line 2, in initialize
File "C:\Users\khyati\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\khyati\Anaconda3\lib\site-packages\IPython\terminal\ipapp.py", line 317, in initialize
self.init_shell()
File "C:\Users\khyati\Anaconda3\lib\site-packages\IPython\terminal\ipapp.py", line 333, in init_shell
ipython_dir=self.ipython_dir, user_ns=self.user_ns)
File "C:\Users\khyati\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Users\khyati\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 431, in __init__
self.init_prompt_toolkit_cli()
File "C:\Users\khyati\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py", line 281, in init_prompt_toolkit_cli
self._eventloop = create_eventloop(self.inputhook)
File "C:\Users\khyati\Anaconda3\lib\site-packages\prompt_toolkit\shortcuts.py", line 95, in create_eventloop
return Loop(inputhook=inputhook, recognize_paste=recognize_win32_paste)
File "C:\Users\khyati\Anaconda3\lib\site-packages\prompt_toolkit\eventloop\win32.py", line 39, in __init__
self._event = _create_event()
File "C:\Users\khyati\Anaconda3\lib\site-packages\prompt_toolkit\eventloop\win32.py", line 187, in _create_event
return windll.kernel32.CreateEventA(pointer(SECURITY_ATTRIBUTES()), BOOL(True), BOOL(False), None)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_ulong instance instead of LP_SECURITY_ATTRIBUTES
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev#python.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
c.Application.verbose_crash=True
Python 3.x.x(v3.x.x: ........)
Type 'copyright', 'credits' or 'license' for more information
IPython x.x.x -- An enhanced Interactive Python. Type '?' for help.
Any help would be appreciated. BTW. I'm using Windows

upgrade to django 1.11.12 error in models/manager.py contribute_to_class

I haven't touched a project in a long time and realized I upgraded my django to version 1.11.12. Trying to re-run project (runserver) and found several out of date packages (easy-thumbnails and psycopg2). Ran pip install upgrade on those. Now when I run, I get the following error and it seems like it is coming form my models? Not sure what it is telling me though or the proper course of action. Maybe there was another upgrade step I missed when I upgraded to django 1.11? (sorry been ages since I touched this code)
Unhandled exception in thread started by <function wrapper at 0x104ab2500>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/shane.thomas/programming/sw_nga_site/swsite/models.py", line 12, in <module>
from filer.fields.image import FilerImageField
File "/usr/local/lib/python2.7/site-packages/filer/fields/image.py", line 4, in <module>
from ..models import Image
File "/usr/local/lib/python2.7/site-packages/filer/models/__init__.py", line 3, in <module>
from .clipboardmodels import * # flake8: noqa
File "/usr/local/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 9, in <module>
from . import filemodels
File "/usr/local/lib/python2.7/site-packages/filer/models/filemodels.py", line 18, in <module>
from .foldermodels import Folder
File "/usr/local/lib/python2.7/site-packages/filer/models/foldermodels.py", line 240, in <module>
mptt.register(Folder)
File "/usr/local/lib/python2.7/site-packages/mptt/__init__.py", line 12, in register
from mptt.models import MPTTModelBase
File "/usr/local/lib/python2.7/site-packages/mptt/models.py", line 379, in <module>
class MPTTModel(six.with_metaclass(MPTTModelBase, models.Model)):
File "/usr/local/lib/python2.7/site-packages/django/utils/six.py", line 808, in __new__
return meta(name, bases, d)
File "/usr/local/lib/python2.7/site-packages/mptt/models.py", line 262, in __new__
cls = super_new(meta, class_name, bases, class_dict)
File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 162, in __new__
new_class.add_to_class(obj_name, obj)
File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "/usr/local/lib/python2.7/site-packages/mptt/managers.py", line 81, in contribute_to_class
super(TreeManager, self).contribute_to_class(model, name)
File "/usr/local/lib/python2.7/site-packages/django/db/models/manager.py", line 120, in contribute_to_class
setattr(model, name, ManagerDescriptor(self))
AttributeError: can't set attribute

Django-MarkItUp: Exception while starting tests (AttributeError: 'str' object has no attribute 'raw')

I can't find the solution for an exception when I start my tests which suddenly accured while coding. The website still works fine with runserver. Here is the full traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module
execute_from_command_line(sys.argv)
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "…/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "…/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "…/lib/python3.5/site-packages/django/core/management/commands/test.py", line 72, in handle
failures = test_runner.run_tests(test_labels)
File "…/lib/python3.5/site-packages/django/test/runner.py", line 549, in run_tests
old_config = self.setup_databases()
File "…/lib/python3.5/site-packages/django/test/runner.py", line 499, in setup_databases
self.parallel, **kwargs
File "…/lib/python3.5/site-packages/django/test/runner.py", line 743, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 78, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "…/lib/python3.5/site-packages/django/db/backends/base/creation.py", line 122, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "…/lib/python3.5/site-packages/django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "…/lib/python3.5/site-packages/django/core/serializers/base.py", line 88, in serialize
self.handle_field(obj, field)
File "…/lib/python3.5/site-packages/django/core/serializers/python.py", line 55, in handle_field
self._current[field.name] = field.value_to_string(obj)
File "…/lib/python3.5/site-packages/markitup/fields.py", line 103, in value_to_string
return value.raw
AttributeError: 'str' object has no attribute 'raw'
Normally I try to narrow the issue down myself. But in this case I don't get anywhere.
I didn't update any packages. These are the packages in question:
Django (1.10.7)
django-markitup (3.0.0)
(The exception disappears when I replace my MarkupField with a standard TextField in models.py.)
Update: The error appears when I use --keepdb successively.
Seems you can fix it by
class MyMarkupField(MarkupField):
def value_to_string(self, obj):
value = self._get_val_from_obj(obj)
if hasattr(value, "raw"):
return value.raw
return value
Then
field = MyMarkupField()
Actually i dont know why this error is coming.

Django migrations: local variable 'field' referenced before assignment

When trying to make migrations in Django I get the following error. Can any help me understand what the problem is and how it possibly can be solved?
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/home/john/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/john/env/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 150, in handle
loader.project_state(),
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/loader.py", line 323, in project_state
return self.graph.make_state(nodes=nodes, at_end=at_end, real_apps=list(self.unmigrated_apps))
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/graph.py", line 409, in make_state
project_state = self.nodes[node].mutate_state(project_state, preserve=False)
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/migration.py", line 92, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/home/john/env/lib/python3.5/site-packages/django/db/migrations/operations/fields.py", line 289, in state_forwards
delay = not field.is_relation
UnboundLocalError: local variable 'field' referenced before assignment
I'm using Django 1.11.1 and Python 3.5.

Why am I getting an error message when trying to run manage.py?

Getting a list of errors in cmd prompt (Windows 8) when trying to run manage.py.
I am trying to follow this tutorial: http://wiki.thinkhole.org/howto:django_on_windows/
I am a little less than half way down the tutorial page.
Can someone please tell me what is going wrong and how to get back on track?
I am trying to get django installed on my computer so i can create a web page with python.
The actual command prompt error log is this:
C:\Py\Scripts\testproject>manage.py runserver
Traceback (most recent call last):
File "C:\Py\Scripts\testproject\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Py\lib\site-packages\django\core\management\__init__.py", line 399, i
n execute_from_command_line
utility.execute()
File "C:\Py\lib\site-packages\django\core\management\__init__.py", line 392, i
n execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Py\lib\site-packages\django\core\management\base.py", line 242, in ru
n_from_argv
self.execute(*args, **options.__dict__)
File "C:\Py\lib\site-packages\django\core\management\base.py", line 280, in ex
ecute
translation.activate('en-us')
File "C:\Py\lib\site-packages\django\utils\translation\__init__.py", line 130,
in activate
return _trans.activate(language)
File "C:\Py\lib\site-packages\django\utils\translation\trans_real.py", line 18
8, in activate
_active.value = translation(language)
File "C:\Py\lib\site-packages\django\utils\translation\trans_real.py", line 17
7, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Py\lib\site-packages\django\utils\translation\trans_real.py", line 15
9, in _fetch
app = import_module(appname)
File "C:\Py\lib\site-packages\django\utils\importlib.py", line 40, in import_m
odule
__import__(name)
File "C:\Py\lib\site-packages\django\contrib\admin\__init__.py", line 3, in <m
odule>
from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
File "C:\Py\lib\site-packages\django\contrib\admin\helpers.py", line 7, in <mo
dule>
from django.contrib.contenttypes.models import ContentType
File "C:\Py\lib\site-packages\django\contrib\contenttypes\models.py", line 129
, in <module>
class ContentType(models.Model):
File "C:\Py\lib\site-packages\django\db\models\base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
TypeError: Error when calling the metaclass bases
__init__() keywords must be strings
C:\Py\Scripts\testproject>

Categories

Resources