You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reproduce: go to Racks, Import Racks; paste the following and hit Submit
site,name,width,u_height
SomeSite,Foo,42,19
Result is a Server Error:
<class 'AttributeError'>
'_csv.reader' object has no attribute 'next'
Traceback received via E-mail:
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/contrib/auth/mixins.py" in dispatch
92. return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/opt/netbox/netbox/utilities/views.py" in post
418. if form.is_valid():
File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py" in is_valid
183. return self.is_bound and not self.errors
File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py" in errors
175. self.full_clean()
File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py" in full_clean
384. self._clean_fields()
File "/usr/local/lib/python3.5/dist-packages/django/forms/forms.py" in _clean_fields
402. value = field.clean(value)
File "/usr/local/lib/python3.5/dist-packages/django/forms/fields.py" in clean
160. value = self.to_python(value)
File "/opt/netbox/netbox/utilities/forms.py" in to_python
252. headers = reader.next()
Exception Type: AttributeError at /dcim/racks/import/
Exception Value: '_csv.reader' object has no attribute 'next'
Judging by this post it appears to be a python 2/3 difference.
Applied following patch by hand:
--- /opt/netbox/netbox/utilities/forms.py.orig 2017-06-13 11:32:37.171228169 +0000
+++ /opt/netbox/netbox/utilities/forms.py 2017-06-14 12:47:19.245315962 +0000
@@ -249,7 +249,7 @@
reader = csv.reader(value.splitlines())
# Consume and valdiate the first line of CSV data as column headers
- headers = reader.next()
+ headers = next(reader)
for f in self.required_fields:
if f not in headers:
raise forms.ValidationError('Required column header "{}" not found.'.format(f))
That appears to fix the problem.
The text was updated successfully, but these errors were encountered:
Issue type: Bug
Python version: 3.5.2 (Ubuntu 16.04)
NetBox version: 2.0.6
To reproduce: go to Racks, Import Racks; paste the following and hit Submit
Result is a Server Error:
Traceback received via E-mail:
Judging by this post it appears to be a python 2/3 difference.
Applied following patch by hand:
That appears to fix the problem.
The text was updated successfully, but these errors were encountered: