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

All exports fail using the Import / Export plugin: module 'os' has no attribute 'pathconf' #4582

Open
MoonlitMonitor opened this issue Sep 8, 2024 · 3 comments

Comments

@MoonlitMonitor
Copy link

MoonlitMonitor commented Sep 8, 2024

Steps to reproduce

I tried to "Export User Data" for the tracks in my library so that I could perform analysis on the resulting JSON using Python to find which genres are rated the highest.

Expected Output

The user data for the tracks should be exported to a JSON file.

Actual Output

After pressing "Run Plugin", I received a prompt saying that "An Error Occurred":

AttributeError: module 'os' has no attribute 'pathconf'
------
Traceback (most recent call last):

  File "C:\Program Files\Quod Libet\lib\python3.11\site-packages\quodlibet\qltk\songsmenu.py", line 243, in __handle
    ret = plugin.plugin_albums(albums)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Program Files\Quod Libet\lib\python3.11\site-packages\quodlibet\ext\songsmenu\import_export_tags_and_track_user_data.py", line 357, in plugin_albums
    self.export_albums(albums, collect_data)

  File "C:\Program Files\Quod Libet\lib\python3.11\site-packages\quodlibet\ext\songsmenu\import_export_tags_and_track_user_data.py", line 599, in export_albums
    self.extract_data_and_export(songs, collect_data)

  File "C:\Program Files\Quod Libet\lib\python3.11\site-packages\quodlibet\ext\songsmenu\import_export_tags_and_track_user_data.py", line 611, in extract_data_and_export
    path = new_export_path_for_album(album_id) if prev_path is None else prev_path
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Program Files\Quod Libet\lib\python3.11\site-packages\quodlibet\ext\songsmenu\import_export_tags_and_track_user_data.py", line 713, in new_export_path_for_album
    path = Path(join_path_with_escaped_name_of_legal_length(str(EXPORT_DIR_PATH), stem,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Program Files\Quod Libet\lib\python3.11\site-packages\quodlibet\util\path.py", line 144, in join_path_with_escaped_name_of_legal_length
    # returns the maximum possible filename length at path (subtract one for dot)
                      ^^^^^^^^^^^

AttributeError: module 'os' has no attribute 'pathconf'

Test System

Which version of Quod Libet?

4.6.0

Which operating system

Windows 11

@MoonlitMonitor
Copy link
Author

As a workaround for exporting the data for the tracks in my library for further analysis, I used the "Export to HTML" plugin instead. The format is not ideal but I can still work with it.

@Spidey01
Copy link

Odds are that chunk of code only supports unix systems. os.pathconf is only available on unix according to the python docs.

@khagaroth
Copy link

Yes, it's unix only. MAX_PATH on Windows wasn't configurable and was always 260 (effectively 256). Since W10 1607, there is now an option to enable long paths, pretty much removing any limit, the filesystem itself can handle names up to 32000 characters long. Problem is that it's not default, needs to be enable in both the system and application manifest and not all system functions work with long paths yet, so hard-coding a limit of 256 on Windows is still a safe bet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants