gbstack / ffprobe-python

A wrapper of ffprobe command to extract metadata from media files.
Other
58 stars 56 forks source link

ImportError: cannot import name 'FFProbe' from partially initialized module 'ffprobe' #11

Open sgraaf opened 3 years ago

sgraaf commented 3 years ago

Hi! I just installed your ffprobe wrapper directly from PyPi, but when I tried to use it (as per the example), I get the following error:

>>> from ffprobe import FFProbe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\sgraaf\AppData\Roaming\Python\Python39\site-packages\ffprobe\__init__.py", line 1, in <module>
    from ffprobe import FFProbe
ImportError: cannot import name 'FFProbe' from partially initialized module 'ffprobe' (most likely due to a circular import) (C:\Users\sgraaf\AppData\Roaming\Python\Python39\site-packages\ffprobe\__init__.py)

I am using ffprobe 0.5 w/ Python 3.9.0 on Windows 10 X64.

hugomcruz commented 3 years ago

I was having the same issue when my script file was called ffprobe.py. Check your filename.

sohpark commented 3 years ago

I was having the same issue when my script file was called ffprobe.py. Check your filename.

how did you fix this problem?

hugomcruz commented 3 years ago

Do you have any file in your project called ffprobe.py? If you have, rename it with some other name.

I had a file in my project with this name, and that was causing the issue, as the FFProbe class is in a ffprobe.py file.

sgraaf commented 3 years ago

I was having the same issue when my script file was called ffprobe.py. Check your filename.

There's no filename to check: I ran into this error directly from the Python REPL (as you might have been able to tell from the >>>)!

RobMullen commented 1 year ago

This is most likely because of the use of the VERY old PyPi package ffprobe, instead of the current one for this project, ffprobe-python

mozai commented 1 year ago

Using ffprobe-0.5-py3, python -c 'import ffprobe' Triggers this problem, this is not caused by a file named "ffprobe.py" in cwd.

hainesdata commented 7 months ago

Reviving since I'm having the same issue as well. I'm running something using pydub in a Jupyter notebook in a virtual python environment. Both ffmpeg and ffprobe are installed in my environment and located in site-packages. I tried the following at the top of the file:

import sys
sys.path.append('/Users/jake/PycharmProjects/py-venv/lib/python3.11/site-packages/ffmpeg')
sys.path.append('/Users/jake/PycharmProjects/py-venv/lib/python3.11/site-packages/ffprobe')
sys.path.append('/Users/jake/PycharmProjects/py-venv/lib/python3.11/site-packages/ffmpeg')

However, when I do import os; print(os.environ['PATH']), none of the above paths are returned.

Anyone had a look at this thread since then? Stumped on this.

eggehad commented 6 months ago

I had the exact same problem. How did I fix it? Turns out i installed this function using: pip install ffprobe, which as RobMullen points out above installs the very old PyPi version. So I uninstalled that one: pip uninstall ffprobe Then I re-installed the correct new one: pip install ffprobe-python. Wha la. Now working correctly. Ideally the docs would be updated to reflect this fact. As it took me a bit of time to figure this one out.