Skip to content

Commit

Permalink
Just open without with to avoid odd crash
Browse files Browse the repository at this point in the history
    [Tue Feb 06 13:57:09.972838 2024] [wsgi:error] [pid 3001752:tid 140299577837248] [client 71.198.184.218:56874] Traceback (most recent call last):, referer: dandi/dandidav#43
    [Tue Feb 06 13:57:09.973156 2024] [wsgi:error] [pid 3001752:tid 140299577837248] [client 71.198.184.218:56874]   File "/srv/datasets.datalad.org/www/dandi/zarr-manifests/myapp.wsgi", line 35, in <lambda>, referer: dandi/dandidav#43
    [Tue Feb 06 13:57:09.973186 2024] [wsgi:error] [pid 3001752:tid 140299577837248] [client 71.198.184.218:56874]     return iter(lambda: fp.read(65535), b""), referer: dandi/dandidav#43
    [Tue Feb 06 13:57:09.973224 2024] [wsgi:error] [pid 3001752:tid 140299577837248] [client 71.198.184.218:56874]                         ^^^^^^^^^^^^^^, referer: dandi/dandidav#43
    [Tue Feb 06 13:57:09.973295 2024] [wsgi:error] [pid 3001752:tid 140299577837248] [client 71.198.184.218:56874] ValueError: read of closed file, referer: dandi/dandidav#43
  • Loading branch information
yarikoptic committed Feb 6, 2024
1 parent 6ad531a commit 8872a68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions myapp.wsgi
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def application(environ, start_response):
("Content-Length", str(os.path.getsize(full_path))),
]
start_response(status, response_headers)
with open(full_path, "rb") as fp:
return iter(lambda: fp.read(65535), b"")
fp = open(full_path, "rb")
return iter(lambda: fp.read(65535), b"")
else:
# List directory contents
files = []
Expand Down

0 comments on commit 8872a68

Please sign in to comment.