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

[Windows] WinError 123 raised for isort >= 4.3.5 #835

Closed
mrogaski opened this issue Feb 25, 2019 · 10 comments
Closed

[Windows] WinError 123 raised for isort >= 4.3.5 #835

mrogaski opened this issue Feb 25, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@mrogaski
Copy link

After upgrading from v4.3.4, I'm getting these errors under Python 3.7.1 on Windows 10. Let me know if you need any other detail.

(env) X:\umami>isort -rc guildmaster
WARNING: Unable to parse file guildmaster\admin.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\admin.py'
WARNING: Unable to parse file guildmaster\apps.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\apps.py'
WARNING: Unable to parse file guildmaster\conf.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\conf.py'
WARNING: Unable to parse file guildmaster\forms.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\forms.py'
WARNING: Unable to parse file guildmaster\models.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\models.py'
WARNING: Unable to parse file guildmaster\tests.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\tests.py'
WARNING: Unable to parse file guildmaster\urls.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\urls.py'
WARNING: Unable to parse file guildmaster\views.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\views.py'
WARNING: Unable to parse file guildmaster\__init__.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\__init__.py'
WARNING: Unable to parse file guildmaster\migrations\0001_initial.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\migrations\\0001_initial.py'
WARNING: Unable to parse file guildmaster\migrations\__init__.py due to [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/X:\\umami\\guildmaster\\migrations\\__init__.py'
@lorengordon
Copy link

I'm getting a lot of this also.

@sedders123
Copy link

sedders123 commented Feb 27, 2019

I get the same error running isort both directly and through flake8-isort, though the flake8-isort traceback looks like it could be more useful.

Traceback (most recent call last):
  File "C:\Program Files\Python37\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\Python37\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\james\Projects\phial\venv\Scripts\flake8.exe\__main__.py", line 9, in <module>
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\main\cli.py", line 18, in main
    app.run(argv)
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\main\application.py", line 394, in run
    self._run(argv)
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\main\application.py", line 382, in _run
    self.run_checks()
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\main\application.py", line 301, in run_checks
    self.file_checker_manager.run()
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\checker.py", line 330, in run
    self.run_serial()
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\checker.py", line 314, in run_serial
    checker.run_checks()
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\checker.py", line 608, in run_checks
    self.run_ast_checks()
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8\checker.py", line 504, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "c:\users\james\projects\phial\venv\lib\site-packages\flake8_isort.py", line 79, in run
    show_diff=True,
  File "c:\users\james\projects\phial\venv\lib\site-packages\isort\isort.py", line 96, in __init__
    if settings.should_skip(file_path, self.config):
  File "c:\users\james\projects\phial\venv\lib\site-packages\isort\settings.py", line 340, in should_skip
    if stat.S_ISFIFO(os.stat(normalized_path).st_mode):
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '/C:\\Users\\james\\Projects\\phial\\phial\\bot.py'

The last line seems to indicate the error is on this line of code which looks like it was updated just before the release of 4.3.5.

Unfortunately I don't understand what this line is doing and don't have time to try and figure it out right now, but if I can figure it out later or someone can give me a pointer then I'm happy to open a PR if I can find a fix.

@mrogaski
Copy link
Author

It looks like PR #810 may have introduced the issue. This line prepends a '/', which causes os.stat to fail.

@mrogaski
Copy link
Author

I'll take a stab at this tonight.

@saites
Copy link

saites commented Feb 27, 2019

I see in this commit two years ago that the code was changed from using os.path to posixpath, but I'm curious if that decision should be reevaluated. From posixpath's docstring:

Instead of importing this module directly, import os and refer to
this module as os.path. The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. ntpath).

It looks like the specific break may be from #792, since it results in stating the file path, which breaks on windows. Perhaps this can be cleaned up and improved by using os.path.isfile (and maybe related isdir/islink) instead of stat.S_ISFIFO. For checking the skip path, maybe os.path.samefile is a better choice.

@lorengordon
Copy link

I see an appveyor.yml config in the repo, but the pull requests don't seem to be triggering appveyor jobs. Would be nice if that integration was (re)enabled so there would be some early indication about breaking changes on Windows.

@ross-weir
Copy link

Also affected 👍

@timothycrosley
Copy link
Member

timothycrosley commented Mar 3, 2019

This should be fixed in the 4.3.10 release of isort: https://github.com/timothycrosley/isort/releases/tag/4.3.10

I am very sorry that Windows compatibility slipped in the last set of releases! It has always been my intention to have full compatibility across Operating Systems and that is why AppVeyor integration was in place. At some point that integration stopped working, I'm not sure yet what caused that. However, I have ensured it is operational again, and I've even spent the money to make sure I have a Windows test VM of my own to ensure compatibility in the future.

Thank you everyone!

~Timothy

@timothycrosley timothycrosley added the bug Something isn't working label Mar 3, 2019
@lorengordon
Copy link

4.3.10 works for me on Windows, thanks!

sedders123 added a commit to sedders123/phial that referenced this issue Mar 3, 2019
Currently we depend on isort as a transitive depenedency of
flake8-isort.

Recently there was an
[issue](PyCQA/isort#835) where an
update to flake8 broke Windows support and by pinnning the version
ourselves we could have not had this issue simply by not updating to the
broken version.
@saites
Copy link

saites commented Mar 4, 2019

Confirmed, working for me as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants