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

Fixed Python script errors flagged by pyflakes #1604

Merged
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
4 changes: 2 additions & 2 deletions python/Scripts/generateshader.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def validateCode(sourceCodeFile, codevalidator, codevalidatorArgs):
print(cmd_flatten)
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
result = output.decode(encoding='utf-8')
return output.decode(encoding='utf-8')
except subprocess.CalledProcessError as out:
return (out.output.decode(encoding='utf-8'))
return ""
Expand Down Expand Up @@ -83,7 +83,7 @@ def main():
try:
mx.loadLibraries(libraryFolders, searchPath, stdlib)
doc.importLibrary(stdlib)
except err:
except Exception as err:
print('Generation failed: "', err, '"')
sys.exit(-1)

Expand Down
10 changes: 6 additions & 4 deletions python/Scripts/genmdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
Generate MDL implementation directory based on MaterialX nodedefs
'''

import sys
import os
import string; os.environ['PYTHONIOENCODING'] = 'utf-8'
import sys

os.environ['PYTHONIOENCODING'] = 'utf-8'

import MaterialX as mx

def usage():
Expand Down Expand Up @@ -345,7 +347,7 @@ def main():

doc = mx.createDocument()
searchPath = os.path.join(_startPath, 'libraries')
libraryPath = os.path.join(searchPath, 'stdlib')
libraryPath = os.path.join(searchPath, LIBRARY)
_loadLibraries(doc, searchPath, libraryPath)

DEFINITION_PREFIX = 'ND_'
Expand Down Expand Up @@ -522,7 +524,7 @@ def main():
if isinstance(elem, mx.Output):
outputValue = elem.getAttribute('default')
if outputValue == '[]':
outputvalue = ''
outputValue = ''
if not outputValue:
outputValue = elem.getAttribute('defaultinput')
if outputValue:
Expand Down
4 changes: 3 additions & 1 deletion python/Scripts/mxdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Print markdown documentation for each nodedef in the given document.
'''

import sys, os, argparse
import argparse
import sys

import MaterialX as mx

HEADERS = ('Name', 'Type', 'Default Value',
Expand Down
4 changes: 3 additions & 1 deletion python/Scripts/mxformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
the documents to the latest version of the standard.
'''

import sys, os, argparse
import argparse
import os

import MaterialX as mx

def main():
Expand Down
6 changes: 4 additions & 2 deletions python/Scripts/mxvalidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Verify that the given file is a valid MaterialX document.
'''

import sys, os, argparse
import argparse
import sys

import MaterialX as mx

def main():
Expand All @@ -25,7 +27,7 @@ def main():
stdlib = mx.createDocument()
try:
mx.loadLibraries(mx.getDefaultDataLibraryFolders(), mx.getDefaultDataSearchPath(), stdlib)
except err:
except Exception as err:
print(err)
sys.exit(0)
doc.importLibrary(stdlib)
Expand Down