From fc039ee0e27dc7ff1325466b67552f406f4ea45e Mon Sep 17 00:00:00 2001 From: Oliver Nagy Date: Sun, 23 Nov 2014 15:23:31 +1100 Subject: [PATCH 1/3] pyassimp/quicktest is now Python 3 compatible. --- port/PyAssimp/scripts/quicktest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/port/PyAssimp/scripts/quicktest.py b/port/PyAssimp/scripts/quicktest.py index 7e8caa3b2..4f45b2984 100755 --- a/port/PyAssimp/scripts/quicktest.py +++ b/port/PyAssimp/scripts/quicktest.py @@ -33,7 +33,7 @@ def run_tests(): ok += 1 except errors.AssimpError as error: # assimp error is fine, this is a controlled case - print error + print(error) err += 1 except Exception: print("Error encountered while loading <%s>"%os.path.join(root,afile)) From 3721b19a6137bb839482016afb8ded5d33056fe1 Mon Sep 17 00:00:00 2001 From: Oliver Nagy Date: Sun, 23 Nov 2014 15:24:17 +1100 Subject: [PATCH 2/3] pyassimp/quicktest now runs without installing pyassimp first. --- port/PyAssimp/pyassimp/core.py | 2 +- port/PyAssimp/scripts/quicktest.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/port/PyAssimp/pyassimp/core.py b/port/PyAssimp/pyassimp/core.py index 8a1e6249b..b5b0441ce 100644 --- a/port/PyAssimp/pyassimp/core.py +++ b/port/PyAssimp/pyassimp/core.py @@ -177,7 +177,7 @@ def _init(self, target = None, parent = None): "and quads. Try to load your mesh with" " a post-processing to triangulate your" " faces.") - sys.exit(1) + raise e else: # starts with 'm' but not iterable diff --git a/port/PyAssimp/scripts/quicktest.py b/port/PyAssimp/scripts/quicktest.py index 4f45b2984..1133c4689 100755 --- a/port/PyAssimp/scripts/quicktest.py +++ b/port/PyAssimp/scripts/quicktest.py @@ -9,8 +9,12 @@ data structures in detail. It just verifies whether basic loading and querying of 3d models using pyassimp works. """ +import os +import sys + +# Make the development (ie. GIT repo) version of PyAssimp available for import. +sys.path.insert(0, '..') -import sys,os import sample from pyassimp import errors From 1e9f3a802d556a7d3b63c04a25a0f5c1b31a7cc2 Mon Sep 17 00:00:00 2001 From: Oliver Nagy Date: Sun, 23 Nov 2014 15:31:35 +1100 Subject: [PATCH 3/3] PEP8 and updated docu strings. --- port/PyAssimp/scripts/quicktest.py | 31 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/port/PyAssimp/scripts/quicktest.py b/port/PyAssimp/scripts/quicktest.py index 1133c4689..cbeccb4ab 100755 --- a/port/PyAssimp/scripts/quicktest.py +++ b/port/PyAssimp/scripts/quicktest.py @@ -18,35 +18,36 @@ sys.path.insert(0, '..') import sample from pyassimp import errors -# paths to be walkd recursively -basepaths = [os.path.join('..','..','..','test','models'), os.path.join('..','..','..','test','models-nonbsd')] +# Paths to model files. +basepaths = [os.path.join('..', '..', '..', 'test', 'models'), + os.path.join('..', '..', '..', 'test', 'models-nonbsd')] + +# Valid extensions for 3D model files. +extensions = ['.3ds', '.x', '.lwo', '.obj', '.md5mesh', '.dxf', '.ply', '.stl', + '.dae', '.md5anim', '.lws', '.irrmesh', '.nff', '.off', '.blend'] -# file extensions to be considered -extensions = ['.3ds','.x','.lwo','.obj','.md5mesh','.dxf','.ply','.stl','.dae','.md5anim','.lws','.irrmesh','.nff','.off','.blend'] def run_tests(): - ok,err = 0,0 + ok, err = 0, 0 for path in basepaths: print("Looking for models in %s..." % path) for root, dirs, files in os.walk(path): for afile in files: - base,ext = os.path.splitext(afile) + base, ext = os.path.splitext(afile) if ext in extensions: try: - sample.main(os.path.join(root,afile)) + sample.main(os.path.join(root, afile)) ok += 1 except errors.AssimpError as error: - # assimp error is fine, this is a controlled case + # Assimp error is fine; this is a controlled case. print(error) err += 1 except Exception: - print("Error encountered while loading <%s>"%os.path.join(root,afile)) - print('** Loaded %s models, got controlled errors for %s files' % (ok,err)) + print("Error encountered while loading <%s>" + % os.path.join(root, afile)) + print('** Loaded %s models, got controlled errors for %s files' + % (ok, err)) if __name__ == '__main__': - run_tests() - - - - + run_tests()