s-weigand / flake8-nb

Flake8 checking for jupyter notebooks
Apache License 2.0
28 stars 8 forks source link

[BUG] pre-commit.ci `Read-only file system` error for v0.5.2 #289

Closed lkeegan closed 1 year ago

lkeegan commented 1 year ago

Describe the bug

v0.5.2 gives an error when ran on pre-commit.ci:

https://results.pre-commit.ci/run/github/515183454/1679944727.JClYHld9R86c8Z37AT7JVQ

flake8-nb................................................................Failed
- hook id: flake8-nb
- exit code: 1

Traceback (most recent call last):
  File "/pc/clone/YcfFcd-3Q7uLovJnWJL3mg/py_env-python3/bin/flake8-nb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/pc/clone/YcfFcd-3Q7uLovJnWJL3mg/py_env-python3/lib/python3.11/site-packages/flake8_nb/__main__.py", line 21, in main
    app = Flake8NbApplication()
          ^^^^^^^^^^^^^^^^^^^^^
  File "/pc/clone/YcfFcd-3Q7uLovJnWJL3mg/py_env-python3/lib/python3.11/site-packages/flake8_nb/flake8_integration/cli.py", line 197, in __init__
    hack_config_module()
  File "/pc/clone/YcfFcd-3Q7uLovJnWJL3mg/py_env-python3/lib/python3.11/site-packages/flake8_nb/flake8_integration/cli.py", line 158, in hack_config_module
    hacked_config_path.write_text(hacked_config_source)
  File "/usr/lib/python3.11/pathlib.py", line 1078, in write_text
    with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/pc/clone/YcfFcd-3Q7uLovJnWJL3mg/py_env-python3/lib/python3.11/site-packages/flake8_nb/flake8_integration/hacked_config.py'

I think this is due to https://github.com/s-weigand/flake8-nb/pull/251 writing the hacked config to disk, and pre-commit.ci running on a read-only filesystem

s-weigand commented 1 year ago

Closed via #290

s-weigand commented 1 year ago

@lkeegan Your fix is available in the v0.5.3 tag

lkeegan commented 1 year ago

@s-weigand many thanks for the fast response! I can confirm v0.5.3 is working for me in pre-commit ci