[GH-ISSUE #1430] CSV import broken #1133

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

Originally created by @almereyda on GitHub (Mar 8, 2018).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1430

Impacted versions

  • Modoboa: 10.10.2
  • installer used: Yes
  • Webserver: Nginx

Steps to reproduce

Run an email import from a CSV formed after http://modoboa.readthedocs.io/en/latest/moving.html#using-csv-files, i.e. one that worked before.

Current behavior

  • In the web frontend, the spinner will just rotate indifinitely.
  • On the command line, an error is thrown:
(env)email# python /srv/modoboa/instance/manage.py modo import accounts.csv
/srv/modoboa/env/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Traceback (most recent call last):                                              |ETA:  --:--:--
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/subcommand/base.py", line 53, in run_from_argv
    return super(SubcommandCommand, self).run_from_argv(argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/subcommand/base.py", line 84, in handle
    return command.run_from_argv(argv)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/admin/management/commands/subcommands/_import.py", line 85, in handle
    self._import(filename, options)
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/admin/management/commands/subcommands/_import.py", line 57, in _import
    reader = csv.reader(f, delimiter=options["sepchar"])
  File "/srv/modoboa/env/local/lib/python2.7/site-packages/backports/csv.py", line 232, in __init__
    raise TypeError('Invalid dialect parameters')
TypeError: Invalid dialect parameters

It feels #1342 was a bit of a too quick shot at #1312 and may need further iterations to constrain the import a little more.

  • SMTPUTF8 for mailbox names is only supported with Postfix 3
  • Domain names should be converted to Punycode

Manually passing dialect='excel' by editing _import.py did not help, either.

github.com/modoboa/modoboa@83d0564c27/modoboa/admin/management/commands/subcommands/_import.py (L57)

The original error may reside around https://github.com/ryanhiebert/backports.csv/blob/master/src/backports/csv.py#L230
Unfortunately the upstream package does not provide a test suite.

Expected behavior

The import completes successfully.

Originally created by @almereyda on GitHub (Mar 8, 2018). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1430 # Impacted versions * Modoboa: 10.10.2 * installer used: Yes * Webserver: Nginx # Steps to reproduce Run an email import from a CSV formed after http://modoboa.readthedocs.io/en/latest/moving.html#using-csv-files, i.e. one that worked before. # Current behavior - In the web frontend, the spinner will just rotate indifinitely. - On the command line, an error is thrown: ``` (env)email# python /srv/modoboa/instance/manage.py modo import accounts.csv /srv/modoboa/env/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>. """) Traceback (most recent call last): |ETA: --:--:-- File "/srv/modoboa/instance/manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/subcommand/base.py", line 53, in run_from_argv return super(SubcommandCommand, self).run_from_argv(argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/subcommand/base.py", line 84, in handle return command.run_from_argv(argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/admin/management/commands/subcommands/_import.py", line 85, in handle self._import(filename, options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/admin/management/commands/subcommands/_import.py", line 57, in _import reader = csv.reader(f, delimiter=options["sepchar"]) File "/srv/modoboa/env/local/lib/python2.7/site-packages/backports/csv.py", line 232, in __init__ raise TypeError('Invalid dialect parameters') TypeError: Invalid dialect parameters ``` It feels #1342 was a bit of a too quick shot at #1312 and may need further iterations to constrain the import a little more. - SMTPUTF8 for mailbox names is only supported with Postfix 3 - Domain names should be converted to Punycode Manually passing `dialect='excel'` by editing `_import.py` did not help, either. https://github.com/modoboa/modoboa/blob/83d0564c27fa1e016f011b50f94a07278532cd6c/modoboa/admin/management/commands/subcommands/_import.py#L57 The original error may reside around https://github.com/ryanhiebert/backports.csv/blob/master/src/backports/csv.py#L230 Unfortunately the upstream package does not provide a test suite. # Expected behavior The import completes successfully.
kerem 2026-02-27 11:15:28 +03:00
Author
Owner

@ghost commented on GitHub (Mar 9, 2018):

Well Line 232 of csv.py destroys any useful error message and replaces it with Invalid dialect parameters.

I don't think this is a utf8 problem, I think options["sepchar"] is either None or an instance of str instead of unicode, I'll need to do some testing in the morning.

Can you try running

python /srv/modoboa/instance/manage.py modo import --sepchar \; accounts.csv
<!-- gh-comment-id:371671398 --> @ghost commented on GitHub (Mar 9, 2018): Well Line 232 of csv.py destroys any useful error message and replaces it with `Invalid dialect parameters`. I don't think this is a utf8 problem, I think `options["sepchar"]` is either None or an instance of `str` instead of `unicode`, I'll need to do some testing in the morning. Can you try running ``` python /srv/modoboa/instance/manage.py modo import --sepchar \; accounts.csv ```
Author
Owner

@almereyda commented on GitHub (Mar 9, 2018):

Thanks for the introspection.

The escaped SEPCHAR yields the very same error.

On 9 March 2018 at 01:22, Andrew Fyfe notifications@github.com wrote:

Well Line 232 of csv.py destroys any useful error message and replaces it
with Invalid dialect parameters.

I don't think this is a utf8 problem, I think options["sepchar"] is
either None or an instance of str instead of unicode, I'll need to do
some testing in the morning.

Can you try running

python /srv/modoboa/instance/manage.py modo import --sepchar ; accounts.csv


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/modoboa/modoboa/issues/1430#issuecomment-371671398,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABka_Fc7ZKE26ZnGMSaejz0yPmJygUrmks5tcctegaJpZM4Sjhmq
.

<!-- gh-comment-id:371798333 --> @almereyda commented on GitHub (Mar 9, 2018): Thanks for the introspection. The escaped SEPCHAR yields the very same error. On 9 March 2018 at 01:22, Andrew Fyfe <notifications@github.com> wrote: > Well Line 232 of csv.py destroys any useful error message and replaces it > with Invalid dialect parameters. > > I don't think this is a utf8 problem, I think options["sepchar"] is > either None or an instance of str instead of unicode, I'll need to do > some testing in the morning. > > Can you try running > > python /srv/modoboa/instance/manage.py modo import --sepchar \; accounts.csv > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/modoboa/modoboa/issues/1430#issuecomment-371671398>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/ABka_Fc7ZKE26ZnGMSaejz0yPmJygUrmks5tcctegaJpZM4Sjhmq> > . >
Author
Owner

@tonioo commented on GitHub (Oct 1, 2018):

@almereyda Is it still happening?

<!-- gh-comment-id:425870732 --> @tonioo commented on GitHub (Oct 1, 2018): @almereyda Is it still happening?
Author
Owner

@almereyda commented on GitHub (Oct 2, 2018):

We didn't have a chance to test it again, but will have next week, Thu 11th
of October.

On Mon, 1 Oct 2018 at 13:12, Antoine Nguyen notifications@github.com
wrote:

@almereyda https://github.com/almereyda Is it still happening?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/modoboa/modoboa/issues/1430#issuecomment-425870732,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABka_DBniQlzhI5axVIoucOxOH6BXXA8ks5ugfiXgaJpZM4Sjhmq
.

<!-- gh-comment-id:426237769 --> @almereyda commented on GitHub (Oct 2, 2018): We didn't have a chance to test it again, but will have next week, Thu 11th of October. On Mon, 1 Oct 2018 at 13:12, Antoine Nguyen <notifications@github.com> wrote: > @almereyda <https://github.com/almereyda> Is it still happening? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/modoboa/modoboa/issues/1430#issuecomment-425870732>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/ABka_DBniQlzhI5axVIoucOxOH6BXXA8ks5ugfiXgaJpZM4Sjhmq> > . >
Author
Owner

@tonioo commented on GitHub (Oct 18, 2018):

@almereyda Any news?

<!-- gh-comment-id:430924449 --> @tonioo commented on GitHub (Oct 18, 2018): @almereyda Any news?
Author
Owner

@augustodv commented on GitHub (Jun 24, 2019):

hello, i have de same error and test all but the error persist.

<!-- gh-comment-id:505103067 --> @augustodv commented on GitHub (Jun 24, 2019): hello, i have de same error and test all but the error persist.
Author
Owner

@Spitfireap commented on GitHub (Jul 15, 2024):

Should be fixed by #3039. Please open a new ticket if it still shows up.

<!-- gh-comment-id:2228372343 --> @Spitfireap commented on GitHub (Jul 15, 2024): Should be fixed by #3039. Please open a new ticket if it still shows up.
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#1133
No description provided.