Skip to content

Commit 654a67b

Browse files
authored
Update pywwwget_deepseek.py
1 parent 8091c38 commit 654a67b

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

pywwwget_deepseek.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -466,20 +466,15 @@ def spooled(max_size=8*1024*1024):
466466

467467
def detect_cwd(ftp, file_dir):
468468
"""
469-
Test whether CWD into file_dir works.
470-
Returns True if it does, False if not (so absolute paths should be used).
469+
Test whether cwd into file_dir works. Returns True if it does,
470+
False if not (so absolute paths should be used).
471471
"""
472-
if not file_dir or file_dir in ("/", "", "."):
473-
return False # nothing to CWD into
474-
472+
if not file_dir:
473+
return False # nothing to cwd into
475474
try:
476-
# Save current directory
477-
orig_pwd = ftp.pwd()
478475
ftp.cwd(file_dir)
479-
# Restore original directory
480-
ftp.cwd(orig_pwd)
481476
return True
482-
except Exception:
477+
except all_errors:
483478
return False
484479

485480
def _ftp_login(ftp, user, pw):
@@ -3210,4 +3205,4 @@ def recv_to_path(url, out_path, auto_extract=False, extract_dir=None,
32103205
sys.exit(1)
32113206
else:
32123207
print("PyWWW-Get (Optimized) v%s" % __version__)
3213-
print("Use '%s help' for usage." % sys.argv[0])
3208+
print("Use '%s help' for usage." % sys.argv[0])

0 commit comments

Comments
 (0)