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

dohq-artifactory doesn't work with Python 3.11.2 #415

Closed
Morfeel opened this issue Apr 27, 2023 · 11 comments · Fixed by #424
Closed

dohq-artifactory doesn't work with Python 3.11.2 #415

Morfeel opened this issue Apr 27, 2023 · 11 comments · Fixed by #424
Labels
Bug good first issue Help Wanted We will be glad if somebody proposes a solution via PR

Comments

@Morfeel
Copy link

Morfeel commented Apr 27, 2023

dohq-artifactory==0.8.2
python --version Python 3.11.2

issue happens when using function:

ArtifactoryPath(xxxxx).mkdir()

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\xxx\Source\xxx\venv\Scripts\invoke.exe_main
.py", line 7, in
File "C:\Users\xxx\Source\xxx\venv\Lib\site-packages\invoke\program.py", line 380, in run
self.execute()
File "C:\Users\xxx\Source\xxx\venv\Lib\site-packages\invoke\program.py", line 565, in execute
executor.execute(*self.tasks)
File "C:\Users\xxx\Source\xxx\venv\Lib\site-packages\invoke\executor.py", line 127, in execute
result = call.task(*args, **call.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xx\Source\xxx\venv\Lib\site-packages\invoke\tasks.py", line 115, in call
result = self.body(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxx\Source\xxx\tasks.py", line 212, in publish
art_path.mkdir()
File "C:\Python311\Lib\pathlib.py", line 1116, in mkdir
os.mkdir(self, mode)

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'https://arti.sssss.com/test/100'

@allburov allburov added Bug good first issue Help Wanted We will be glad if somebody proposes a solution via PR labels Apr 27, 2023
@ukuko
Copy link

ukuko commented May 20, 2023

i can confirm it... we have to stick to python 3.10 so far.

@allburov
Copy link
Member

allburov commented May 20, 2023

Hi! Feel free to create PR to support new python version!
Personally I don't have time but will review the changes asap

@scorpion35
Copy link

@allburov I see 3.11 support was added while ago? Not sure if something else needs to be done?

I am new to this library (and kinda new to Python as well). Any tips on what to check to help speed up the debugging of this issue?

@beliaev-maksim
Copy link
Member

@scorpion35 if we you can provide an access to the staging env of artifactory we may have a look

the problem is that we do not have access to artifactory instances to run the test

@scorpion35
Copy link

@scorpion35 if we you can provide an access to the staging env of artifactory we may have a look

the problem is that we do not have access to artifactory instances to run the test

Unfortunately it is a company instance. Don't want to go to jail for fixing a bug 😅 I don't have a personal one to provide access to 🙂

If you can give me some tips, I can debug. Am hoping this will be a good exercise for me to get to know Python and friends

@beliaev-maksim
Copy link
Member

@scorpion35
I think new python version added some validation for paths, where http URL is obviously not passing. We might want to debug and see how we can bypass the check

@PribhuPatel
Copy link

@beliaev-maksim
There is a major change in pathlib Python library that also comes as a core Python package and it is breaking the file upload task to artifactory.

Issue in Python Issue portal: https://bugs.python.org/issue43012
Github repo MR in CPython: python/cpython#25701

@beliaev-maksim
Copy link
Member

@PribhuPatel do not think it is the issue. We already fixed it. Might be a different left over

#376

@ktdreyer
Copy link
Contributor

I'm still seeing errors with Python 3.11.4 (Fedora 37). iterdir() and mkdir() fail with errors like FileNotFoundError

@allburov
Copy link
Member

If anyone have time - please have a look at the issue, we're open for Pull Requests!

flichtenheld added a commit to flichtenheld/dohq_artifactory that referenced this issue Jul 18, 2023
pathlib in Python 3.11 implements mkdir and rmdir directly
in terms of calling os.<func> without any accessor layer.
So copy the implementations of those functions from Python
3.10 to get the previous behavior back.

Fixes: devopshq#415

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
@flichtenheld
Copy link
Contributor

If anyone have time - please have a look at the issue, we're open for Pull Requests!

Done. Please let me know what you think.

allburov pushed a commit that referenced this issue Jul 24, 2023
* ArtifactoryPath: fix mkdir and rmdir with Python 3.11

pathlib in Python 3.11 implements mkdir and rmdir directly
in terms of calling os.<func> without any accessor layer.
So copy the implementations of those functions from Python
3.10 to get the previous behavior back.

Fixes: #415

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>

* test_artifactory_path: Add basic unit test for mkdir()

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>

* ArtifactoryPath: Fix glob() in Python 3.11

Python 3.11 replaced _accessor.scandir with _scandir.
Override _scandir to still use our implementation.
Should be a noop on older Python versions because they
didn't have _scandir at all.

Fixes: #396

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>

---------

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug good first issue Help Wanted We will be glad if somebody proposes a solution via PR
Development

Successfully merging a pull request may close this issue.

8 participants