jython - Python os.walk() failing -
i have created script give me list of files in folder directory. yet, getting error. mean?
portion of error:
script failed due error: traceback (most recent call last): file "<script>", line 12, in <module> file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\os.py", line 309, in walk file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\os.py", line 299, in walk file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\genericpath.py", line 41, in isdir file "c:\program files\nuix\nuix 6\lib\jython.jar\lib\genericpath.py", line 41, in isdir java.lang.abstractmethoderror: org.python.modules.posix.pythonposixhandler.error(ljnr/constants/platform/errno;ljava/lang/string;ljava/lang/string;)v @ jnr.posix.basenativeposix.stat(basenativeposix.java:309) @ jnr.posix.checkedposix.stat(checkedposix.java:265) @ jnr.posix.lazyposix.stat(lazyposix.java:267)
the script:
import os import codecs import shutil import datetime import sys exportpath = 'p:/output/export7/{6136baf2-85ba-4e64-8c11-a2c59398fc02}/' tempnativefolder = 'nativesorig' dir, sub, file in os.walk(exportpath + tempnativefolder): fname in file: #source path source = os.path.join(dir, fname).replace('\\', '/') print source print("natives moved subfolders")
i found out presence of these characters(see "diamond question mark" character in screenshot) in file name causes issue. once replaced those, script works. much.
Comments
Post a Comment