Hello, I'm using regular expressions to check if arguments of a function are valid. When I run the code below, I get an error.
Basically, what the regular expression "should" expect is either an integer, or an integer followed by a letter (string). I convert the tested argument to a string to make sure. Below is the code. # Create regular expression to match oPattern = re.compile( r"(\d+|\d+\D)", re.IGNORECASE ) # Iterate provided arguments for oArg in aArgs: # Attempt to match the argument to the regular expression oMatch = re.match( str( oArg ), 0 ) The error I get is this: #ERROR : Traceback (most recent call last): # File "<Script Block >", line 208, in BuildProjectPaths_Execute # aShotInfos = handleArguments( args ) # File "<Script Block >", line 123, in handleArguments # oMatch = re.match( str( oArg ), 0 ) # File "D:\Python24\Lib\sre.py", line 129, in match # return _compile(pattern, flags).match(string) #TypeError: expected string or buffer # - [line 122] I have to admit I have no idea what is going here, I'm very new to Python's regular expressions. I have used some prints and I know the error occurs at the re.match() call. Thanks Bernard _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor