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
  Structuring a large class: privite vs public methods 6hearts 3 1,083 May-05-2023, 10:06 AM
Last Post: Gribouillis
  '' FTP '' File upload with a specified string and rename midomarc 1 1,176 Apr-17-2023, 03:04 AM
Last Post: bowlofred
  Need Help: FileNotFoundError:[Errno 2] No such file or directory python202209 5 2,672 Sep-12-2022, 04:50 AM
Last Post: python202209
  Unable to upload file using FTP korenron 2 2,495 Dec-23-2021, 12:44 PM
Last Post: korenron
Thumbs Up Parsing a YAML file without changing the string content..?, Flask - solved. SpongeB0B 2 2,286 Aug-05-2021, 08:02 AM
Last Post: SpongeB0B
  FileNotFoundError: [Errno 2] No such file or directory: 'word2vec.model' Anldra12 6 6,080 Jul-07-2021, 07:29 AM
Last Post: Anldra12
  FileNotFoundError: [Errno 2] No such file or directory: 'model/doc2vec.model/Articles Anldra12 10 5,831 Jun-11-2021, 04:48 PM
Last Post: snippsat
  FileNotFoundError: [Errno 2] No such file or directory: 5l3y3r 6 8,146 Nov-02-2020, 12:48 PM
Last Post: 5l3y3r
  SQLAlchemy Flask ERROR: no such column XXX marcello86 0 2,867 Aug-31-2020, 09:21 AM
Last Post: marcello86
  Getting FileNotFoundError: [Errno 2] ,if tries to acees same file from sub-directory pmpinaki 2 2,531 May-04-2020, 03:39 PM
Last Post: pmpinaki

Forum Jump:

User Panel Messages

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