devopshq/artifactory

mkdir() is not working under Python 3.11 (with authentication)

Closed this issue · 6 comments

I start with an empty repository called unittests-public under https://audeering.jfrog.io/artifactory
when I execute the following code it works under Python 3.8, 3.9, 3.10:

import artifactory

path = artifactory.ArtifactoryPath(
    'https://audeering.jfrog.io/artifactory/unittests-public/com/audeering/audfactory',
    auth=(
        'audeering-unittest',
        '<APIKEY>',  # replace with needed API key
    ),
)
path.parent.mkdir()

under Python 3.11 I get instead

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[5], line 1
----> 1 path.parent.mkdir()

File /usr/lib/python3.11/pathlib.py:1116, in Path.mkdir(self, mode, parents, exist_ok)
   1112 """
   1113 Create a new directory at this given path.
   1114 """
   1115 try:
-> 1116     os.mkdir(self, mode)
   1117 except FileNotFoundError:
   1118     if not parents or self.parent == self:

FileNotFoundError: [Errno 2] No such file or directory: 'https://audeering.jfrog.io/artifactory/unittests-public/com/audeering'

Hello,
Is there any update regarding this issue ? @allburov do you have any highlights ?
I'm having a similar issue with ArtifactoryPath.glob which works well on 3.7 to 3.10. But on Python3.11 also raising a FileNotFoundError.

File /usr/lib/python3.11/pathlib.py:953, in Path.glob(self, pattern)
    951     pattern_parts.append('')
    952 selector = _make_selector(tuple(pattern_parts), self._flavour)
--> 953 for p in selector.select_from(self):
    954     yield p

File /usr/lib/python3.11/pathlib.py:408, in _RecursiveWildcardSelector._select_from(self, parent_path, is_dir, exists, scandir)
    406 successor_select = self.successor._select_from
    407 for starting_point in self._iterate_directories(parent_path, is_dir, scandir):
--> 408     for p in successor_select(starting_point, is_dir, exists, scandir):
    409         if p not in yielded:
    410             yield p

File /usr/lib/python3.11/pathlib.py:355, in _WildcardSelector._select_from(self, parent_path, is_dir, exists, scandir)
    353 def _select_from(self, parent_path, is_dir, exists, scandir):
    354     try:
--> 355         with scandir(parent_path) as scandir_it:
    356             entries = list(scandir_it)
    357         for entry in entries:

File /usr/lib/python3.11/pathlib.py:938, in Path._scandir(self)
    934 def _scandir(self):
    935     # bpo-24132: a future version of pathlib will support subclassing of
    936     # pathlib.Path to customize how the filesystem is accessed. This
    937     # includes scandir(), which is used to implement glob().
--> 938     return os.scandir(self)

Thanks for your help and your time !

The glob method is tracked at #396, but it might indeed be that both issues have the same underlying cause.

Oh indeed you are right, I've missed this issue sorry for the duplicate.

This is still an issue in release 0.9.0.
PR #376 says it added support, but this was incomplete.
PR #424 looks to be the actual fix, hopefully this can be released soon?

@RichardTea thank you for noticing it, published new version with the fix! https://github.com/devopshq/artifactory/releases/tag/0.9.1

hagenw commented

Thank you very much for implementing a fix.
I can confirm that the issue is solved with release 0.9.1.