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

oschmod does not work with pathlib.Path in Windows #111

Open
zapplecat opened this issue Aug 22, 2021 · 0 comments · May be fixed by #112
Open

oschmod does not work with pathlib.Path in Windows #111

zapplecat opened this issue Aug 22, 2021 · 0 comments · May be fixed by #112

Comments

@zapplecat
Copy link

Describe the bug

The pathlib works with oschmod on OSX and Linux pathlib.Path, but on Windows, we get TypeError: Objects of type 'WindowsPath' can not be converted to Unicode.

Your configuration

Windows 8.1, Python 3.9.6

Steps to reproduce

Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import oschmod
>>> import pathlib
>>> p = pathlib.Path('E:/Projects/test.txt')
>>> oschmod.get_mode(p)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\Projects\oschmod_venv\lib\site-packages\oschmod\__init__.py", line 163, in get_mode
    return win_get_permissions(path)
  File "E:\Projects\oschmod_venv\lib\site-packages\oschmod\__init__.py", line 364, in win_get_permissions
    return _win_get_permissions(path, get_object_type(path))
  File "E:\Projects\oschmod_venv\lib\site-packages\oschmod\__init__.py", line 376, in _win_get_permissions
    sec_des = win32security.GetNamedSecurityInfo(
TypeError: Objects of type 'WindowsPath' can not be converted to Unicode.
>>> oschmod.get_mode('E:/Projects/test.txt')
7

Expected behavior
pathlib.Path works with oschmod operations

What happened instead
pathlib.Path with oschmod operations fails with TypeError

Additional context
Add any other context about the problem here.

zapplecat added a commit to zapplecat/oschmod that referenced this issue Aug 22, 2021
@zapplecat zapplecat linked a pull request Aug 22, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant