Discussion:
SyntaxError: keyword argument repeated
Dennis Alabi
2018-11-07 14:50:46 UTC
Permalink
django.setup()
File
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py",
line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py",
line 112, in populate
app_config.import_models()
File
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py",
line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
File
"C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py",
line 85
on_delete=models.CASCADE,related_name="'zone's", null=True,
related_name='children'
^
SyntaxError: keyword argument repeated


I get the above error and the potion of my code causing it in models.py is
given below, please help out

# Relationship Fields
user = ForeignKey(
'customers.User',
on_delete=models.CASCADE, related_name="users"
)
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True,
related_name='children'
)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/277c4a05-6744-4d77-b571-db4e5a42386d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Matthew Pava
2018-11-07 14:55:24 UTC
Permalink
The error message says “keyword argument repeated”
Look at the keyword arguments and check for repeated ones.
I see it in the definition of parent. Do you see it?


From: django-***@googlegroups.com [mailto:django-***@googlegroups.com] On Behalf Of Dennis Alabi
Sent: Wednesday, November 7, 2018 8:51 AM
To: Django users
Subject: SyntaxError: keyword argument repeated


django.setup()
File "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py", line 85
on_delete=models.CASCADE,related_name="'zone's", null=True, related_name='children'
^
SyntaxError: keyword argument repeated


I get the above error and the potion of my code causing it in models.py is given below, please help out

# Relationship Fields
user = ForeignKey(
'customers.User',
on_delete=models.CASCADE, related_name="users"
)
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True, related_name='children'
)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com<mailto:django-users+***@googlegroups.com>.
To post to this group, send email to django-***@googlegroups.com<mailto:django-***@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/277c4a05-6744-4d77-b571-db4e5a42386d%40googlegroups.com<https://groups.google.com/d/msgid/django-users/277c4a05-6744-4d77-b571-db4e5a42386d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/624423a6bae949b5966429bb426a3426%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.
Vishvajit Pathak
2018-11-08 20:02:57 UTC
Permalink
in the code

parent = ForeignKey(
Post by Dennis Alabi
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True,
related_name='children'
)
key `related_name` is repeated
Post by Dennis Alabi
django.setup()
File
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py",
line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py",
line 112, in populate
app_config.import_models()
File
"C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py",
line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in
source_to_code
File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
File
"C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py",
line 85
on_delete=models.CASCADE,related_name="'zone's", null=True,
related_name='children'
^
SyntaxError: keyword argument repeated
I get the above error and the potion of my code causing it in models.py is
given below, please help out
# Relationship Fields
user = ForeignKey(
'customers.User',
on_delete=models.CASCADE, related_name="users"
)
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True,
related_name='children'
)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/95dffaa5-a961-483e-b946-d870757c76f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ryan Gedwill
2018-11-09 01:50:56 UTC
Permalink
You can only pass in a keyword argument once, you pass in related_name twice in one of your properties

Sent from my iPhone
Post by Vishvajit Pathak
in the code
Post by Dennis Alabi
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True, related_name='children'
)
key `related_name` is repeated
Post by Dennis Alabi
django.setup()
File "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Users\User\Anaconda3\envs\myprogv\lib\site-packages\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\User\Anaconda3\envs\myprogv\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\User\Documents\cctv_project\openCV\cam_project\customers\models.py", line 85
on_delete=models.CASCADE,related_name="'zone's", null=True, related_name='children'
^
SyntaxError: keyword argument repeated
I get the above error and the potion of my code causing it in models.py is given below, please help out
# Relationship Fields
user = ForeignKey(
'customers.User',
on_delete=models.CASCADE, related_name="users"
)
parent = ForeignKey(
'customers.Zone',
on_delete=models.CASCADE, related_name="'zone's", null=True, related_name='children'
)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/95dffaa5-a961-483e-b946-d870757c76f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8C827210-1EC5-4BA5-89CC-6A1B841126A7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...