KristoforMaynard / music-tag

Simple interface to edit audio file metadata
MIT License
125 stars 19 forks source link

ERRROR: partially initialized module `music_tag` has no attribute `load_file` #13

Closed quyleanh closed 3 years ago

quyleanh commented 3 years ago

I faced the issue when using your module.

The step procedure is following:

  1. Install music-tag

    ~/work/script/music_tag pip3 install music-tag --upgrade
    Requirement already up-to-date: music-tag in /home/quyleanh/.local/lib/python3.8/site-packages (0.4.2)
    Requirement already satisfied, skipping upgrade: mutagen in /usr/local/lib/python3.8/dist-packages/mutagen-1.45.1-py3.8.egg (from music-tag) (1.45.1)
  2. Run python script

    ~/work/script/music_tag python3 music_tag.py
    Traceback (most recent call last):
    File "music_tag.py", line 1, in <module>
    import music_tag
    File "/home/quyleanh/work/script/music_tag/music_tag.py", line 4, in <module>
    f = music_tag.load_file("test.flac")
    AttributeError: partially initialized module 'music_tag' has no attribute 'load_file' (most likely due to a circular import)

My music_tag.py content is following:

import music_tag

f = music_tag.load_file("test.flac")
print(f['title'])

Could you please take a look at this?

KristoforMaynard commented 3 years ago

You named your script with the same name as the library... the script is importing itself.

quyleanh commented 3 years ago

Thank you very much. My bad 😆