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

Python 3.11+ compatibility #1

Open
mundiplaga opened this issue Sep 16, 2024 · 1 comment
Open

Python 3.11+ compatibility #1

mundiplaga opened this issue Sep 16, 2024 · 1 comment

Comments

@mundiplaga
Copy link

Hello!

Thank you so much for this script! It has helped me create a bunch of GTA 5 content in VRChat!

I noticed that when using this script in Python 3.11 or 3.12, I get an error from the glob2 module:

Traceback (most recent call last):
  File "C:\Users\jay\projects\python\temp\openformat-to-obj\openformat-to-obj.py", line 325, in <module>
    odr_paths = glob2.glob(args.glob)
                ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\projects\python\temp\openformat-to-obj\glob2\impl.py", line 58, in glob
    return list(self.iglob(pathname, with_matches, include_hidden))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\projects\python\temp\openformat-to-obj\glob2\impl.py", line 120, in _iglob
    for name, groups in self.resolve_pattern(
                        ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\projects\python\temp\openformat-to-obj\glob2\impl.py", line 177, in resolve_pattern
    return fnmatch.filter(names, pattern)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\projects\python\temp\openformat-to-obj\glob2\fnmatch.py", line 55, in filter
    match = _compile_pattern(pat)
            ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\projects\python\temp\openformat-to-obj\glob2\fnmatch.py", line 49, in _compile_pattern
    return re.compile(res).match
           ^^^^^^^^^^^^^^^
  File "C:\Users\jay\AppData\Local\Programs\Python\Python312\Lib\re\__init__.py", line 228, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\AppData\Local\Programs\Python\Python312\Lib\re\__init__.py", line 307, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\AppData\Local\Programs\Python\Python312\Lib\re\_compiler.py", line 745, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\AppData\Local\Programs\Python\Python312\Lib\re\_parser.py", line 979, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\AppData\Local\Programs\Python\Python312\Lib\re\_parser.py", line 460, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jay\AppData\Local\Programs\Python\Python312\Lib\re\_parser.py", line 840, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 11

This led me to try just changing the glob2 import and usage to glob and delete the glob2 directory and the script worked just fine for my limited use case of GTA5 Pedestrian models. I am unsure if the glob2 is maybe necessary for some other .odr files I'm not aware of, or other files in general.

I went through some compatibility testing in my own forked repo and found the .odr files extracted just fine with this change in Python 3.3 -> 3.12

@twilson90
Copy link
Owner

I barely remember writing this to be honest.
I'm sure there must have been a reason I used glob2 and embedded it locally instead of using the builtin glob module.
Perhaps it was something wrong with my python installation at the time. Can't say for certain but it was probably something like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants