Closed Orchardseed closed 1 year ago
Hi, I tried it in unbuntu but also get this error Environment SlideScore Python API version: How installed: download zip and conda create environment and pip install -e . Python version: 3.9 / 3.9.12 Operating System: unbuntu bug2.txt
Hi, this seems to be an error in newer versions of tqdm/python. Downgrade to a lower version. @lromor also encountered it, perhaps he can shed some light.
Hi @Orchardseed , try to downgrade tqdm to version 4.50.0!
@jonasteuwen if this fixes it, maybe consider tying tqdm to a specific version in the deps.
Hi @Orchardseed, is this problem fixed?
Yes, thanks for help! @AjeyPaiK
This still leaves me with the top part of the error, for several python versions, on MacOS (M1) and Linux.
(slidescore-api) y.schirris@eratosthenes:~/til-validation/1_download_wsis_from_slidescore$ slidescore --slidescore-url https://slidescore.nki.nl/ -s 2540 -v download-wsis ./data/
0%| | 0/3826 [00:00<?, ?it/s]
0%| | 0/3826 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/y.schirris/miniconda3/envs/slidescore-api/bin/slidescore", line 8, in <module>
sys.exit(cli())
File "/home/y.schirris/slidescore-api/slidescore_api/cli.py", line 607, in cli
args.subcommand(args)
File "/home/y.schirris/slidescore-api/slidescore_api/cli.py", line 426, in _download_wsi
download_wsis(
File "/home/y.schirris/slidescore-api/slidescore_api/cli.py", line 407, in download_wsis
filename = client.download_slide(study_id, image, save_dir=save_dir)
File "/home/y.schirris/slidescore-api/slidescore_api/api.py", line 262, in download_slide
with tqdm.wrapattr(
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1488, in wrapattr
with tclass(total=total, **tkwargs) as t:
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1048, in __init__
self.refresh(lock_args=self.lock_args)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1336, in refresh
self.display()
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1469, in display
self.sp(self.__repr__() if msg is None else msg)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1087, in __repr__
return self.format_meter(**self.format_dict)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 423, in format_meter
bool_prefix_colon_already = (prefix[-2:] == ": ")
TypeError: 'PosixPath' object is not subscriptable
Exception ignored in: <function tqdm.__del__ at 0x7f660b5881f0>
Traceback (most recent call last):
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1084, in __del__
self.close()
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1291, in close
self.display(pos=0)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1469, in display
self.sp(self.__repr__() if msg is None else msg)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 1087, in __repr__
return self.format_meter(**self.format_dict)
File "/home/y.schirris/miniconda3/envs/slidescore-api/lib/python3.8/site-packages/tqdm/std.py", line 423, in format_meter
bool_prefix_colon_already = (prefix[-2:] == ": ")
TypeError: 'PosixPath' object is not subscriptable
(slidescore-api) y.schirris@eratosthenes:~/til-validation/1_download_wsis_from_slidescore$ python --version
Python 3.8.13
(slidescore-api) y.schirris@eratosthenes:~/til-validation/1_download_wsis_from_slidescore$ python
Python 3.8.13 (default, Oct 21 2022, 23:50:54)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tqdm
>>> tqdm.__version__
'4.45.0'
>>>
It appears that the above still exists because a Path
object is passed to TQDM, while TQDM expects a str
. The above merge requests fixes both issues discussed in this issue
4.45.0
Path
to str
before passing it to TQDM, not changing the object itself for the rest of the scriptHi Yoni. Did you try to upgrade tqdm to version 4.50.0? I forget the details, but it worked for me last time. If it still doesn't work, we can ask to fix them again.
that solves
Exception ignored in: <function tqdm.del at 0x000001C26D7B1DC0>
Traceback (most recent call last):
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1162, in del
self.close()
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1291, in close
if self.last_print_t < self.start_t + self.delay:
AttributeError: 'tqdm' object has no attribute 'last_print_t'
but that doesn't solve the problem above it, where tqdm
expects a string and we give it a pathlib.Path
object.
PR #39 should solve both these issues
Describe the bug Hi, I try to used slidescore-api to download slides, but got error.
To Reproduce (slidescoreapi) D:\Python\Yuan\image>slidescore -t D:\Python\Yuan\image\oldkey -s 1361 download-wsis D:\Python\Yuan\image\originalimages 0%| | 0/20 [00:00<?, ?it/s] 0%| | 0/20 [00:00<?, ?it/s] Traceback (most recent call last): File "D:\Python\Anaconda3\envs\slidescoreapi\Scripts\slidescore-script.py", line 33, in
sys.exit(load_entry_point('slidescore-api', 'console_scripts', 'slidescore')())
File "d:\python\yuan\slidescore-api-main\slidescore_api\cli.py", line 502, in cli
args.subcommand(args)
File "d:\python\yuan\slidescore-api-main\slidescore_api\cli.py", line 351, in _download_wsi
download_wsis(
File "d:\python\yuan\slidescore-api-main\slidescore_api\cli.py", line 332, in download_wsis
filename = client.download_slide(study_id, image, save_dir=save_dir)
File "d:\python\yuan\slidescore-api-main\slidescore_api\api.py", line 258, in download_slide
with tqdm.wrapattr(
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\contextlib.py", line 119, in enter
return next(self.gen)
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1528, in wrapattr
with cls(total=total, tqdm_kwargs) as t:
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1109, in init
self.refresh(lock_args=self.lock_args)
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1361, in refresh
self.display()
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1509, in display
self.sp(self.str() if msg is None else msg)
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1165, in str
return self.format_meter(self.format_dict)
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 475, in format_meter
bool_prefix_colon_already = (prefix[-2:] == ": ")
TypeError: 'WindowsPath' object is not subscriptable
Exception ignored in: <function tqdm.del at 0x000001C26D7B1DC0>
Traceback (most recent call last):
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1162, in del
self.close()
File "D:\Python\Anaconda3\envs\slidescoreapi\lib\site-packages\tqdm\std.py", line 1291, in close
if self.last_print_t < self.start_t + self.delay:
AttributeError: 'tqdm' object has no attribute 'last_print_t'
Expected behavior Command Line should download the slides from slidescore
Environment SlideScore Python API version: How installed: 1. clone from github open in Pycharm / 2. download zip and conda create environment and pip install -e . Python version: 3.9 / 3.9.12 Operating System: Window
Additional context bug.txt