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

Fix calls to removed os.path.walk #2314

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ https://mhammond.github.io/pywin32_installers.html.
Coming in build 308, as yet unreleased
--------------------------------------

* Update calls to removed (in Python 3) calls to `os.path.walk`, which fixes the following: (#2314, @Avasam)
* `VersionStamp/bulkstamp.py` script
* `com/win32comext/shell/demos/dump_link.py` demo
* `com/win32comext/shell/demos/servers/empty_volume_cache.py` demo
* `com/win32comext/shell/demos/viewstate.py` demo
* Fixed a circular import between `win32comext.axscript.client.framework` and `win32comext.axscript.client.error` (#2381, @Avasam)

Build 307, released 2024-10-04
Expand Down
4 changes: 2 additions & 2 deletions com/win32comext/shell/demos/dump_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def DumpLink(fname):


def FavDumper(nothing, path, names):
# called by os.path.walk
# called by os.walk
for name in names:
print(name, end=" ")
try:
Expand All @@ -39,7 +39,7 @@ def FavDumper(nothing, path, names):
def DumpFavorites():
favfold = str(shell.SHGetSpecialFolderPath(0, shellcon.CSIDL_FAVORITES))
print("Your favourites are at", favfold)
os.path.walk(favfold, FavDumper, None)
os.walk(favfold, FavDumper, None)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions com/win32comext/shell/demos/servers/empty_volume_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _GetDirectories(self):
]

def _WalkCallback(self, arg, directory, files):
# callback function for os.path.walk - no need to be member, but it's
# callback function for os.walk - no need to be member, but it's
# close to the callers :)
callback, total_list = arg
for file in files:
Expand Down Expand Up @@ -119,7 +119,7 @@ def GetSpaceUsed(self, callback):
total = [0] # See _WalkCallback above
try:
for d in self._GetDirectories():
os.path.walk(d, self._WalkCallback, (callback, total))
os.walk(d, self._WalkCallback, (callback, total))
print("After looking in", d, "we have", total[0], "bytes")
except pythoncom.error as exc:
# This will be raised by the callback when the user selects 'cancel'.
Expand All @@ -134,7 +134,7 @@ def Purge(self, amt_to_free, callback):
# GetSpaceUsed
try:
for d in self._GetDirectories():
os.path.walk(d, self._WalkCallback, (callback, None))
os.walk(d, self._WalkCallback, (callback, None))
except pythoncom.error as exc:
# This will be raised by the callback when the user selects 'cancel'.
if exc.hresult != winerror.E_ABORT:
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/shell/demos/viewstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def update_colinfo(not_used, dir_name, fnames):
pb = None


os.path.walk(template_folder, update_colinfo, None)
os.walk(template_folder, update_colinfo, None)
2 changes: 1 addition & 1 deletion win32/help/security_directories.html
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ <h3><A NAME="#Extend_Get_py">Python code</a></h3>
if os.path.isdir(args[0]):
print("walking thru",args[0])
get_perm_base(args[0])
os.path.walk(args[0],get_perms,opts['-d'])
os.walk(args[0],get_perms,opts['-d'])
else:
print("Directory",args[0],"does not exist")
sys.exit(0)
Expand Down
2 changes: 1 addition & 1 deletion win32/scripts/VersionStamp/bulkstamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def scan(build, root, desc, **custom_vars):
vars.update(custom_vars)

arg = vars, debug, descriptions
os.path.walk(root, walk, arg)
os.walk(root, walk, arg)

print("Stamped %d files." % (numStamped))

Expand Down
Loading