dawnbeen / c_formatter_42

C language formatter for 42 norminette
GNU General Public License v3.0
160 stars 16 forks source link

TypeError when using c_formatter_42 in Python 3.11.6 #73

Open axellee1994 opened 9 months ago

axellee1994 commented 9 months ago
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/homebrew/lib/python3.11/site-packages/c_formatter_42/__main__.py", line 18, in <module>
    from c_formatter_42.run import run_all
  File "/opt/homebrew/lib/python3.11/site-packages/c_formatter_42/run.py", line 14, in <module>
    from c_formatter_42.formatters.clang_format import clang_format
  File "/opt/homebrew/lib/python3.11/site-packages/c_formatter_42/formatters/clang_format.py", line 21, in <module>
    DATA_DIR = Path(c_formatter_42.data.__file__).parent
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py", line 871, in __new__
    self = cls._from_parts(args)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py", line 509, in _from_parts
    drv, root, parts = self._parse_args(args)
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py", line 493, in _parse_args
    a = os.fspath(a)
        ^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType

42-c-format: Please read README and check requirements.

Can you please help me understand what's going wrong?

cacharle commented 9 months ago

It's weird, with almost the same version of Python, I have no problem running it.

❯ python
Python 3.11.5 (main, Aug 24 2023, 15:23:30) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import c_formatter_42.data
>>> print(c_formatter_42.data.__file__)
/.../c_formatter_42/c_formatter_42/data/__init__.py
❯ echo 'int main() { return 0; }' | c_formatter_42
int     main(void)
{
        return (0);
}