Python Forum
Error (Errno 2), File upload with the Flask framework and a public IP
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error (Errno 2), File upload with the Flask framework and a public IP
#1
Hello everyone,

I would like to use the Flask framework to make a file upload over the internet. Locally over my home network and the localhost, the upload works without errors. But if I use the public IP the file dont copy to my server and I got the error message which you can see below. I'm using the versions Python 3.7.3, Apache 2 server and the Raspberry IOS Debian 10.13 OS.

I've already tried a few things at the code, even the solution with the os module at memory path (file.save(os.path. …)), but this also does not worked.
I'm looking forward to an answers from you. Thank you.

I got the following error message:
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] [DATE] ERROR in app: Exception on /upload [POST]
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] Traceback (most recent call last):
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] response = self.full_dispatch_request()
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] rv = self.handle_user_exception(e)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] reraise(exc_type, exc_value, tb)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
[DATE [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] raise value
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] rv = self.dispatch_request()
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] return self.view_functions[rule.endpoint](**req.view_args)
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/var/www/app/app.py", line 17, in upload
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] file.save('uploads/{file.filename}')
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] File "/usr/lib/python3/dist-packages/werkzeug/datastructures.py", line 2725, in save
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] dst = open(dst, 'wb')
[DATE] [wsgi:error] [pid 3007] [remote Public IP-ADDRESS] FileNotFoundError: [Errno 2] No such file or directory: 'uploads/{file.filename}'

Greeting UP1
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  FileNotFoundError: [Errno 2] No such file or directory although the file exists Arnibandyo 0 1,222 Aug-12-2024, 09:11 AM
Last Post: Arnibandyo
  How can I upload a .gz file to the Swift Object Storage using Python swift client? Hanginium65 0 827 Jul-24-2024, 03:24 PM
Last Post: Hanginium65
  "[Errno 2] No such file or directory" (.py file) IbrahimBennani 13 7,062 Jun-17-2024, 12:26 AM
Last Post: AdamHensley
  Structuring a large class: privite vs public methods 6hearts 3 2,013 May-05-2023, 10:06 AM
Last Post: Gribouillis
  '' FTP '' File upload with a specified string and rename midomarc 1 2,351 Apr-17-2023, 03:04 AM
Last Post: bowlofred
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 6,401 Sep-12-2022, 04:50 AM
Last Post: python202209
  Unable to upload file using FTP korenron 2 3,749 Dec-23-2021, 12:44 PM
Last Post: korenron
Thumbs Up Parsing a YAML file without changing the string content..?, Flask - solved. SpongeB0B 2 3,227 Aug-05-2021, 08:02 AM
Last Post: SpongeB0B
  FileNotFoundError: [Errno 2] No such file or directory: 'word2vec.model' Anldra12 6 8,346 Jul-07-2021, 07:29 AM
Last Post: Anldra12
  FileNotFoundError: [Errno 2] No such file or directory: 'model/doc2vec.model/Articles Anldra12 10 9,671 Jun-11-2021, 04:48 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020