Skip to content

Commit 273b8a5

Browse files
authored
Fixed Python script errors flagged by pyflakes (#1604)
1 parent e45d67f commit 273b8a5

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

python/Scripts/generateshader.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def validateCode(sourceCodeFile, codevalidator, codevalidatorArgs):
2525
print(cmd_flatten)
2626
try:
2727
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
28-
result = output.decode(encoding='utf-8')
28+
return output.decode(encoding='utf-8')
2929
except subprocess.CalledProcessError as out:
3030
return (out.output.decode(encoding='utf-8'))
3131
return ""
@@ -83,7 +83,7 @@ def main():
8383
try:
8484
mx.loadLibraries(libraryFolders, searchPath, stdlib)
8585
doc.importLibrary(stdlib)
86-
except err:
86+
except Exception as err:
8787
print('Generation failed: "', err, '"')
8888
sys.exit(-1)
8989

python/Scripts/genmdl.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
Generate MDL implementation directory based on MaterialX nodedefs
44
'''
55

6-
import sys
76
import os
8-
import string; os.environ['PYTHONIOENCODING'] = 'utf-8'
7+
import sys
8+
9+
os.environ['PYTHONIOENCODING'] = 'utf-8'
10+
911
import MaterialX as mx
1012

1113
def usage():
@@ -345,7 +347,7 @@ def main():
345347

346348
doc = mx.createDocument()
347349
searchPath = os.path.join(_startPath, 'libraries')
348-
libraryPath = os.path.join(searchPath, 'stdlib')
350+
libraryPath = os.path.join(searchPath, LIBRARY)
349351
_loadLibraries(doc, searchPath, libraryPath)
350352

351353
DEFINITION_PREFIX = 'ND_'
@@ -522,7 +524,7 @@ def main():
522524
if isinstance(elem, mx.Output):
523525
outputValue = elem.getAttribute('default')
524526
if outputValue == '[]':
525-
outputvalue = ''
527+
outputValue = ''
526528
if not outputValue:
527529
outputValue = elem.getAttribute('defaultinput')
528530
if outputValue:

python/Scripts/mxdoc.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
Print markdown documentation for each nodedef in the given document.
44
'''
55

6-
import sys, os, argparse
6+
import argparse
7+
import sys
8+
79
import MaterialX as mx
810

911
HEADERS = ('Name', 'Type', 'Default Value',

python/Scripts/mxformat.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
the documents to the latest version of the standard.
55
'''
66

7-
import sys, os, argparse
7+
import argparse
8+
import os
9+
810
import MaterialX as mx
911

1012
def main():

python/Scripts/mxvalidate.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
Verify that the given file is a valid MaterialX document.
44
'''
55

6-
import sys, os, argparse
6+
import argparse
7+
import sys
8+
79
import MaterialX as mx
810

911
def main():
@@ -25,7 +27,7 @@ def main():
2527
stdlib = mx.createDocument()
2628
try:
2729
mx.loadLibraries(mx.getDefaultDataLibraryFolders(), mx.getDefaultDataSearchPath(), stdlib)
28-
except err:
30+
except Exception as err:
2931
print(err)
3032
sys.exit(0)
3133
doc.importLibrary(stdlib)

0 commit comments

Comments
 (0)