identify them with ``os.path.islink(file)`` and ``os.path.isdir(file)``, and
invoke :func:`walk` as necessary.
- .. note::
+ .. warning::
- The newer :func:`os.walk` :term:`generator` supplies similar functionality
- and can be easier to use.
+ This function is deprecated and is removed in 3.0 in favor of
+ :func:`os.walk`.
.. data:: supports_unicode_filenames
"""Pathname and path-related operations for the Macintosh."""
import os
+import warnings
from stat import *
import genericpath
from genericpath import *
beyond that arg is always passed to func. It can be used, e.g., to pass
a filename pattern, or a mutable object designed to accumulate
statistics. Passing None for arg is common."""
-
+ warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.")
try:
names = os.listdir(top)
except os.error:
import sys
import stat
import genericpath
+import warnings
+
from genericpath import *
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
beyond that arg is always passed to func. It can be used, e.g., to pass
a filename pattern, or a mutable object designed to accumulate
statistics. Passing None for arg is common."""
-
+ warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.")
try:
names = os.listdir(top)
except os.error:
import os
import stat
import genericpath
+import warnings
from genericpath import *
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
beyond that arg is always passed to func. It can be used, e.g., to pass
a filename pattern, or a mutable object designed to accumulate
statistics. Passing None for arg is common."""
-
+ warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.")
try:
names = os.listdir(top)
except os.error:
for module_name in self.all_platforms:
self.check_removal(module_name)
+ def test_os_path_walk(self):
+ msg = "In 3.x, os.path.walk is removed in favor of os.walk."
+ def dumbo(where, names, args): pass
+ for path_mod in ("ntpath", "macpath", "os2emxpath", "posixpath"):
+ mod = __import__(path_mod)
+ with catch_warning() as w:
+ # Since os3exmpath just imports it from ntpath
+ warnings.simplefilter("always")
+ mod.walk(".", dumbo, None)
+ self.assertEquals(str(w.message), msg)
+
def test_main():
run_unittest(TestPy3KWarnings, TestStdlibRemovals)
- test.test_support.catch_warning() gained a 'record' argument.
+- os.path.walk is deprecated in favor of os.walk.
+
Build
-----