Import/Export on python 3 fails #668

Closed
opened 2025-12-29 16:24:35 +01:00 by adam · 1 comment
Owner

Originally created by @flycam on GitHub (Jan 29, 2017).

On python 3.5 imports and exports are failing with an exception.

Trying to export anything (connections, prefixes, devices etc) returns:

<class 'NameError'>

name 'unicode' is not defined

On Import any input triggers this error:

<class '_csv.Error'>

iterator should return strings, not bytes (did you open the file in text mode?)

running the same netbox installation on 2.7 works just fine.
Repo cloned on 2017-01-28

Originally created by @flycam on GitHub (Jan 29, 2017). On python 3.5 imports and exports are failing with an exception. Trying to export anything (connections, prefixes, devices etc) returns: ``` <class 'NameError'> name 'unicode' is not defined ``` On Import any input triggers this error: ``` <class '_csv.Error'> iterator should return strings, not bytes (did you open the file in text mode?) ``` running the same netbox installation on 2.7 works just fine. Repo cloned on 2017-01-28
adam added the type: bug label 2025-12-29 16:24:35 +01:00
adam closed this issue 2025-12-29 16:24:35 +01:00
Author
Owner

@hnk commented on GitHub (Jan 31, 2017):

We run into the same issue during import in a python3 install of version 1.8.3.

Django debug says the exact spot of the error is here:
https://github.com/digitalocean/netbox/blob/develop/netbox/utilities/forms.py#L247

What's interesting is that from reading up on the error people suggest to run through a utf-8 decode before reading the data and here it is encoded right before...

Exporting fails at a different code path, but I do not have that debug in front of me right now...

@hnk commented on GitHub (Jan 31, 2017): We run into the same issue during import in a python3 install of version 1.8.3. Django debug says the exact spot of the error is here: https://github.com/digitalocean/netbox/blob/develop/netbox/utilities/forms.py#L247 What's interesting is that from reading up on the error people suggest to run through a utf-8 decode before reading the data and here it is encoded right before... Exporting fails at a different code path, but I do not have that debug in front of me right now...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#668