[GH-ISSUE #1312] Error 500 Import CSV #1058

Closed
opened 2026-02-27 11:15:00 +03:00 by kerem · 6 comments
Owner

Originally created by @carbans on GitHub (Nov 30, 2017).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1312

Impacted versions

  • Modoboa: 1.9.1
  • installer used: Yes/No ?
    Yes
  • Webserver: Nginx/Apache
    Nginx

Steps to reproduce

Identities / Import

Current behavior

I can't import csv with users, Javascript browser console throws 500 Error(see Screenshot) when it's try to access to https://server.com/admin/identities/import/

Video/Screenshot link (optional)

https://imgur.com/a/CnU7g

Originally created by @carbans on GitHub (Nov 30, 2017). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1312 # Impacted versions * Modoboa: 1.9.1 * installer used: Yes/No ? Yes * Webserver: Nginx/Apache Nginx # Steps to reproduce Identities / Import # Current behavior I can't import csv with users, Javascript browser console throws 500 Error(see Screenshot) when it's try to access to https://server.com/admin/identities/import/ # Video/Screenshot link (optional) https://imgur.com/a/CnU7g
kerem 2026-02-27 11:15:00 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tonioo commented on GitHub (Dec 3, 2017):

Could you retry with DEBUG set to True inside settings.py? Otherwise you can also test the command line version (http://modoboa.readthedocs.io/en/latest/moving.html#using-csv-files)

<!-- gh-comment-id:348758171 --> @tonioo commented on GitHub (Dec 3, 2017): Could you retry with DEBUG set to True inside settings.py? Otherwise you can also test the command line version (http://modoboa.readthedocs.io/en/latest/moving.html#using-csv-files)
Author
Owner

@tonioo commented on GitHub (Dec 15, 2017):

@carbans ping

<!-- gh-comment-id:352030666 --> @tonioo commented on GitHub (Dec 15, 2017): @carbans ping
Author
Owner

@carbans commented on GitHub (Dec 19, 2017):

Sorry for the delay, I tried with the settings Debug to True, but this has not worked, I was doing tests and detected that the error is because I enter names with accents or special characters such as º, ª

I think that you process the file before uploading it, Is it done using javascript?

It would be great if we could add accents and special characters

<!-- gh-comment-id:352789375 --> @carbans commented on GitHub (Dec 19, 2017): Sorry for the delay, I tried with the settings Debug to True, but this has not worked, I was doing tests and detected that the error is because I enter names with accents or special characters such as º, ª I think that you process the file before uploading it, Is it done using javascript? It would be great if we could add accents and special characters
Author
Owner

@tonioo commented on GitHub (Dec 22, 2017):

In which column(s) did you put special characters?

<!-- gh-comment-id:353560120 --> @tonioo commented on GitHub (Dec 22, 2017): In which column(s) did you put special characters?
Author
Owner

@ghost commented on GitHub (Jan 3, 2018):

@carbans Are you using Python 2.7?

github.com/modoboa/modoboa@168743f74b/modoboa/admin/views/import_.py (L43-L52)

I haven't tested it yet but I think this should be:

infile = codecs.open(request.FILES["sourcefile"].file, mode="r", encoding="utf8")
reader = reader = csv.reader(
                infile,
                delimiter=smart_str(form.cleaned_data["sepchar"])
            )
<!-- gh-comment-id:355102817 --> @ghost commented on GitHub (Jan 3, 2018): @carbans Are you using Python 2.7? https://github.com/modoboa/modoboa/blob/168743f74b4107f055844e2979025a4d03faa198/modoboa/admin/views/import_.py#L43-L52 I haven't tested it yet but I think this should be: ```python infile = codecs.open(request.FILES["sourcefile"].file, mode="r", encoding="utf8") reader = reader = csv.reader( infile, delimiter=smart_str(form.cleaned_data["sepchar"]) ) ```
Author
Owner

@ghost commented on GitHub (Jan 3, 2018):

Found a simpler solution, use the back ported csv module it supports Python 3.

See #1342

<!-- gh-comment-id:355160020 --> @ghost commented on GitHub (Jan 3, 2018): Found a simpler solution, use the back ported csv module it supports Python 3. See #1342
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1058
No description provided.