Skip to content

Commit 7296386

Browse files
author
Daniel Coelho
committed
Non-strict mode by default; Change warning message
1 parent 1381f6e commit 7296386

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pywavefront/parser.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434

3535
import os
3636
import pyglet
37+
import logging
3738

3839
class Parser(object):
3940
"""This defines a generalized parse dispatcher; all parse functions
4041
reside in subclasses."""
42+
strict = False
4143

4244
def read_file(self, file_name):
4345
for line in open(file_name, 'r'):
@@ -65,9 +67,12 @@ def parse(self, line, dir):
6567

6668
attrib = 'parse_%s' % line_type
6769

68-
if hasattr(self, attrib):
70+
if Parser.strict:
71+
parse_function = getattr(self, attrib)
72+
parse_function(args)
73+
elif hasattr(self, attrib):
6974
parse_function = getattr(self, attrib)
7075
parse_function(args)
7176
else:
72-
print("[PyWavefront] WARNING: Unimplemented OBJ format statement \'%s\' on line \'%s\'"
73-
% (line_type, line.rstrip()))
77+
logging.warning("Unimplemented OBJ format statement '%s' on line '%s'"
78+
% (line_type, line.rstrip()))

0 commit comments

Comments
 (0)