python - No error when stepping through in debug mode but AttributeError otherwise -
example code
from pathlib import path f in path(<dir>).iterdir(): print(f._str) i'm using pass function not works when running or debug without breakpoint. using breakpoint , stepping through prints out fine (_str total path!
i'm not sure trying or print, but, yes, throws attributeerror. because, well, ._str not attribute of path class.
from pathlib import path f in path('/tmp').iterdir(): print(f._str) attributeerror: _str this print full path.
for f in path('/tmp').iterdir(): print(f) /tmp/com.apple.launchd.0cerufd5ee /tmp/com.apple.launchd.jlac2vpwps /tmp/com.apple.launchd.jyih6h3f8i if want names of files & directories, print(f.name)
Comments
Post a Comment