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

test_files(redownload=True) has no session defined. #40

Open
JTerwel opened this issue Nov 3, 2023 · 1 comment
Open

test_files(redownload=True) has no session defined. #40

JTerwel opened this issue Nov 3, 2023 · 1 comment

Comments

@JTerwel
Copy link

JTerwel commented Nov 3, 2023

I am trying to download images through Simeon Reusch's fpbot code, which uses ztfquery for the download.
While downloading an object I got a timeout error due to too many requests in a short timespan. This was caused by trying to run too many parallel downloads, and was fixed by reducing the number before restarting my code.

The crash however seems to have caused some files to be corrupted. Luckily ztfquery should check for this after a download and will redownload the corrupted files. This however causes a crash as no session has been defined.

ztfquery.io.test_files() does not define session (but it could be defined through **kwargs?) and is called from ztfquery.query.download_data(), which does not provide a definition for session, causing the issue.

This is the relevant part of the error message:
Traceback (most recent call last):
...
File "/home/users/terwelj/Late-time_interactions/real-time_version/lc_generator.py", line 102, in run_fpbot
pl.download()
File "/home/users/terwelj/.conda/envs/real-time_search/lib/python3.10/site-packages/fpbot/pipeline.py", line 496, in download
fp.io.download_data(
File "/home/users/terwelj/.conda/envs/real-time_search/lib/python3.10/site-packages/ztflc/io.py", line 131, in download_data
self.zquery.download_data(
File "/home/users/terwelj/.conda/envs/real-time_search/lib/python3.10/site-packages/ztfquery/query.py", line 470, in download_data
fileissue = io.test_files(
File "/home/users/terwelj/.conda/envs/real-time_search/lib/python3.10/site-packages/ztfquery/io.py", line 720, in test_files
session=session,
NameError: name 'session' is not defined

@JTerwel
Copy link
Author

JTerwel commented Nov 9, 2023

The fix is quite simple: just define the session properly just before the call that uses it by adding

session = open_irsa_session()

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

No branches or pull requests

1 participant