Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"I/O operation on closed file" when uploading a CSV file #8250

Closed
2 tasks done
Ereza opened this issue Oct 19, 2022 · 1 comment
Closed
2 tasks done

"I/O operation on closed file" when uploading a CSV file #8250

Ereza opened this issue Oct 19, 2022 · 1 comment
Assignees
Labels
bug Something is broken.
Milestone

Comments

@Ereza
Copy link
Contributor

Ereza commented Oct 19, 2022

Describe the issue

I have a default installation of Weblate using Docker. I have been using it for several personal projects with no problem, but after some months without using it, I am suddenly having an issue that I have no idea how to fix, and there seems to be no information about it around the web. It could be some kind of configuration change on my server, but since the error message is so cryptic, I'm reporting it as a bug.

I have a project setup with English as the source language. I am trying to upload a new version of the English source file through the "Upload translation" form. I choose the CSV file, select "Replace the existing translation file" (it's the only option) and leave the rest with the default values. I submit the form and all I get is an error: "File upload failed: I/O operation on closed file."

The Docker container logs only display this:

weblate_1   | gunicorn stderr | [2022-10-19 19:59:48,186: INFO/366] my-project/my-component: skipped push: upstream not configured
weblate_1   | gunicorn stderr | [2022-10-19 19:59:49,256: WARNING/366] Upload error: ValueError: I/O operation on closed file.
weblate_1   | nginx stdout | 172.25.0.1 - - [19/Oct/2022:19:59:49 +0200] "POST /upload/my-project/my-component/en/ HTTP/1.1" 302 5 "https://myhost.tld/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"

Trying the same operation via API also leads to the same error:

Request:
curl -X POST -F file=@my_file.csv -F conflicts=replace-translated -F author=MyName -F email=my@email.tld -F method=replace -H "Authorization: Token MY_TOKEN" https://myhost.tld/api/translations/my-project/my-component/en/file/
Output:
{"file":"I/O operation on closed file."}

What could be the issue causing this error and how could I fix it? Could the error message be improved in some way?

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

  1. Navigate to the component English translation page (https://myhost.tld/projects/my-project/my-component/en/).
  2. Choose "Upload translation".
  3. Choose the source CSV file, select "Replace the existing translation file" (it's the only option) and keep the other options at the default values.
  4. Click on "Upload".
  5. The error "File upload failed: I/O operation on closed file." is shown.

Expected behavior

The file is uploaded successfuly, or, if there is a server configuration issue, a more user-friendly message is shown.

Screenshots

No response

Exception traceback

No response

How do you run Weblate?

Docker container

Weblate versions

  • Weblate: 4.14.1
  • Django: 4.1.1
  • siphashc: 2.1
  • translate-toolkit: 3.7.3
  • lxml: 4.9.1
  • Pillow: 9.2.0
  • bleach: 5.0.1
  • python-dateutil: 2.8.2
  • social-auth-core: 4.3.0
  • social-auth-app-django: 5.0.0
  • django-crispy-forms: 1.14.0
  • oauthlib: 3.2.1
  • django-compressor: 4.1
  • djangorestframework: 3.13.1
  • django-filter: 22.1
  • django-appconf: 1.0.5
  • user-agents: 2.2.0
  • filelock: 3.8.0
  • rapidfuzz: 2.8.0
  • openpyxl: 3.0.10
  • celery: 5.2.7
  • kombu: 5.2.4
  • translation-finder: 2.14
  • weblate-language-data: 2022.7
  • html2text: 2020.1.16
  • pycairo: 1.21.0
  • pygobject: 3.42.2
  • diff-match-patch: 20200713
  • requests: 2.28.1
  • django-redis: 5.2.0
  • hiredis: 2.0.0
  • sentry_sdk: 1.9.8
  • Cython: 0.29.32
  • misaka: 2.1.1
  • GitPython: 3.1.27
  • borgbackup: 1.2.2
  • pyparsing: 3.0.9
  • pyahocorasick: 1.4.4
  • python-redis-lock: 3.7.0
  • charset-normalizer: 2.1.1
  • Python: 3.10.7
  • Git: 2.30.2
  • psycopg2: 2.9.3
  • psycopg2-binary: 2.9.3
  • phply: 1.2.5
  • ruamel.yaml: 0.17.21
  • tesserocr: 2.5.2
  • boto3: 1.24.73
  • zeep: 4.1.0
  • aeidon: 1.11
  • iniparse: 0.5
  • mysqlclient: 2.1.1
  • Mercurial: 6.2.2
  • git-svn: 2.30.2
  • git-review: 2.3.1
  • Redis server: 6.2.7
  • PostgreSQL server: 14.5
  • Database backends: django.db.backends.postgresql
  • Cache backends: default:RedisCache, avatar:FileBasedCache
  • Email setup: django.core.mail.backends.smtp.EmailBackend: smtp.gmail.com
  • OS encoding: filesystem=utf-8, default=utf-8
  • Celery: redis://cache:6379/1, redis://cache:6379/1, regular
  • Platform: Linux 4.19.0-22-amd64 (x86_64)

Weblate deploy checks

System check identified some issues:

WARNINGS:
?: (security.W018) You should not have DEBUG set to True in deployment.

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
	HINT: https://docs.weblate.org/en/weblate-4.14.1/admin/install.html#collecting-errors

System check identified 2 issues (1 silenced).

Additional context

No response

@nijel nijel self-assigned this Oct 21, 2022
@nijel nijel added the bug Something is broken. label Oct 21, 2022
@nijel nijel added this to the 4.14.2 milestone Oct 21, 2022
@nijel nijel closed this as completed in e92d569 Oct 21, 2022
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken.
Projects
None yet
Development

No branches or pull requests

2 participants