Cphrampus / DnDAppFiles

Files for the Fifth Edition apps by Lion's Den
48 stars 15 forks source link

Error when running the script #407

Closed mnefstead closed 4 years ago

mnefstead commented 4 years ago

I'm getting the following error when I try to run the script with Python 3.8:

File "create_compendiums.py", line 263, in create_class_compendiums class_name, subclass_name = re.search(r"/([^/]+)/([^/]+)\.xml$", file).groups() AttributeError: 'NoneType' object has no attribute 'groups'

Arguments were -b complete -s usable -e MF HB IL. The same thing happened with reference, and without the exclusions, and with both the master and beta branches.

I'm afraid I don't know enough about regular expressions to troubleshoot this error. I'd appreciate any suggestions!

Edit: solved this issue. For a windows file system (which uses backslashes instead of forward slashes), it seems the line in question must be replaced with the following: class_name, subclass_name = re.search(r"\\([^/]+)\\([^/]+)\.xml$", file).groups()

153957 commented 4 years ago

Haha, interesting. The globs do work with the forward slashes: glob('Character/Classes/*/*.xml'), but the paths of the returned files do have backslashes 😖 maybe they can be converted to have forward slashes, or we should use pathlib..