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
tqdm has no attribute 'disable' #158
Comments
Thats.. weird. It seems like a bug in tqdm, but looking at their Is this reproducible? Could you maybe add some print statements into tqdm, in |
Explicitly creating a "disable" attribute in the class definition outside the method fixes this particular problem. Perhaps some kind of Python3 class issue? It's completely reproducible. wormhole on that machine is non-functional as a result. :-) |
could you paste the full |
Thanks to @cyli, we tracked this down to a tqdm bug, where it's somehow misidentifying your operating system, and then fails to handle a return value that's None. Could you run this snippet and see if it fails on your box? import tqdm, sys, time
progress = tqdm.tqdm(file=sys.stderr, unit="B", unit_scale=True, total=100)
with progress:
for i in range(100):
progress.update(i)
time.sleep(0.01)
print "exiting" If it's the bug we think it is, that will fail with something like:
The tqdm object has a And then our use of The root problem is probably in tqdm._utils, in this code: from platform import system as _curos
CUR_OS = _curos()
IS_WIN = CUR_OS in ['Windows', 'cli']
IS_NIX = (not IS_WIN) and any(
CUR_OS.startswith(i) for i in
['CYGWIN', 'MSYS', 'Linux', 'Darwin', 'SunOS', 'FreeBSD', 'NetBSD']) and then this: def _environ_cols_wrapper(): # pragma: no cover
"""
Return a function which gets width and height of console
(linux,osx,windows,cygwin).
"""
_environ_cols = None
if IS_WIN:
_environ_cols = _environ_cols_windows
if _environ_cols is None:
_environ_cols = _environ_cols_tput
if IS_NIX:
_environ_cols = _environ_cols_linux
return _environ_cols I think that on your machine, neither IS_WIN nor IS_NIX are True, so |
I just took a look at the current tqdm issues and pull requests, and didn't see this problem anywhere. tqdm/tqdm#383 might be related, as it shows an internal use of an attribute failing. What does If you patch your If that helps, then we can go file a tqdm bug and recommend that they tolerate an unrecognized system better. I think the |
Hello! I guess I'll answer your notes each in turn.
Changing your snippet to:
... and then runing it results in:
Subsequently, I ran the additional bits:
For the platform:
HOWEVER in examining the code, I do see the IS_NIX check does not check for NetBSD. Instead, it looks like this: IS_NIX = (not IS_WIN) and any(
CUR_OS.startswith(i) for i in
['CYGWIN', 'MSYS', 'Linux', 'Darwin', 'SunOS', 'FreeBSD']) I corrected that to include NetBSD, and it now works.
I don't believe I need to file an issue with the tqdm people, because another NetBSD type has already done so, here: tqdm/tqdm@a379e33 So.. looks like all I need is just a simple fix after all. |
Hi guys, thanks for your great work looking into this. Secondly, are you sure it is unsafe for |
No problem! Thanks for making such a great tool, it's been really convenient for us.
So I guess I'd recommend something conservative, and also looking carefully at the |
well that was a fun way to see how many people are using I recall reading up about |
You might consider having a separate object which implements the cleanup code, and have the main Anyways, for this ticket, I think the fix will be to bump our dependency to the current version (4.14.0). I'll make a patch for that in a minute. Thanks to everyone for digging into this one! |
System is a slightly dated NetBSD environment. tqdm is the latest version, installed via pip and Python version is as follows. It can be corrected (but then a bunch of other missing attribute errors suddenly show up) by adding an explicit attribute in the tqdm class definition.
Traceback follows:
The text was updated successfully, but these errors were encountered: