opengisch / qpip

GNU General Public License v3.0
10 stars 3 forks source link

TypeError in combination with QFieldSync #19

Open m-kuhn opened 6 hours ago

m-kuhn commented 6 hours ago

It worked great on one of my computers and failed on another:

This is the traceback:

pyplugin_installer.instance().onManagerClose()

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users/axa/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\a00_qpip\plugin.py", line 127, in patched_load_plugin
    dialog, run_gui = self.check_deps(additional_plugins=[packageName])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/axa/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\a00_qpip\plugin.py", line 156, in check_deps
    if os.path.dirname(dist._path) != self.site_packages_path:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 277, in dirname
  File "", line 241, in split
TypeError: expected str, bytes or os.PathLike object, not Path

I diged a little bit deeper and added this line `log(f'dist: {dist._path}')` to which dist that failed: I don't get why it failed, but maybe through a try expect block around that check?

2024-09-25T08:01:17     INFO    dist: C:\Users\axa\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\qfieldsync\libqfieldsync.whl/libqfieldsync-1.0.dist-info/

(the update seems to work nicely apart from this minor error!)

Originally posted by @axelande in https://github.com/opengisch/qpip/issues/14#issuecomment-2373104359

m-kuhn commented 6 hours ago

I think this comes from here https://github.com/opengisch/qfieldsync/blob/master/qfieldsync/__init__.py#L31

@axelande I tried to reproduced with a small sample here but didn't manage

import pathlib
import os

p = pathlib.Path(__file__).parent.resolve() 
os.path.dirname(p)

is this code breaking at your place?