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

On Ubuntu, get_ffmpeg_exe causes AttributeError: 'PosixPath' object has no attribute 'startswith' #96

Closed
Kosinkadink opened this issue Oct 20, 2023 · 2 comments

Comments

@Kosinkadink
Copy link

Kosinkadink commented Oct 20, 2023

Hey, there appears to be a bug on Ubuntu (and potentially other linux systems), where importing get_ffmpeg_exe results in AttributeError: 'PosixPath' object has no attribute 'startswith'. Additional info: the code was being executed on remote VMs like runpod, but running Ubuntu.

I am reporting this one the behalf of some other peeps who ran into this issue. Here is the full stack trace to help narrow down the problem. My intuition says something just needs to be cast to string, because on linux/Ubuntu, something returns a PosixPath.

2023-10-18T14:14:15.336368834Z   File "/usr/lib/python3.10/pkgutil.py", line 417, in get_importer
2023-10-18T14:14:15.336371751Z     importer = sys.path_importer_cache[path_item]
2023-10-18T14:14:15.336374287Z KeyError: PosixPath('/workspace/ComfyUI')
2023-10-18T14:14:15.336376547Z
2023-10-18T14:14:15.336378896Z During handling of the above exception, another exception occurred:
2023-10-18T14:14:15.336381189Z
2023-10-18T14:14:15.336383674Z Traceback (most recent call last):
2023-10-18T14:14:15.336385957Z   File "/workspace/ComfyUI/nodes.py", line 1735, in load_custom_node
2023-10-18T14:14:15.336388253Z     module_spec.loader.exec_module(module)
2023-10-18T14:14:15.336390524Z   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2023-10-18T14:14:15.336392763Z   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-10-18T14:14:15.336400783Z   File "/workspace/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/__init__.py", line 1, in <module>
2023-10-18T14:14:15.336403599Z     from .videohelpersuite.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
2023-10-18T14:14:15.336406051Z   File "/workspace/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/nodes.py", line 26, in <module>
2023-10-18T14:14:15.336408501Z     from imageio_ffmpeg import get_ffmpeg_exe
2023-10-18T14:14:15.336410748Z   File "/venv/lib/python3.10/site-packages/imageio_ffmpeg/__init__.py", line 7, in <module>
2023-10-18T14:14:15.336412943Z     from ._io import count_frames_and_secs, read_frames, write_frames
2023-10-18T14:14:15.336415104Z   File "/venv/lib/python3.10/site-packages/imageio_ffmpeg/_io.py", line 8, in <module>
2023-10-18T14:14:15.336417279Z     from ._parsing import LogCatcher, cvsecs, parse_ffmpeg_header
2023-10-18T14:14:15.336419453Z   File "/venv/lib/python3.10/site-packages/imageio_ffmpeg/_parsing.py", line 5, in <module>
2023-10-18T14:14:15.336421683Z     from ._utils import logger
2023-10-18T14:14:15.336424533Z   File "/venv/lib/python3.10/site-packages/imageio_ffmpeg/_utils.py", line 7, in <module>
2023-10-18T14:14:15.336426910Z     from pkg_resources import resource_filename
2023-10-18T14:14:15.336429098Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3328, in <module>
2023-10-18T14:14:15.336431308Z     def _initialize_master_working_set():
2023-10-18T14:14:15.336433538Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3302, in _call_aside
2023-10-18T14:14:15.336435741Z     f(*args, **kwargs)
2023-10-18T14:14:15.336438355Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3340, in _initialize_master_working_set
2023-10-18T14:14:15.336440525Z     working_set = WorkingSet._build_master()
2023-10-18T14:14:15.336442738Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 622, in _build_master
2023-10-18T14:14:15.336444996Z     ws = cls()
2023-10-18T14:14:15.336448457Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 615, in __init__
2023-10-18T14:14:15.336450715Z     self.add_entry(entry)
2023-10-18T14:14:15.336452955Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 671, in add_entry
2023-10-18T14:14:15.336455188Z     for dist in find_distributions(entry, True):
2023-10-18T14:14:15.336457402Z   File "/venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2075, in find_distributions
2023-10-18T14:14:15.336459588Z     importer = get_importer(path_item)
2023-10-18T14:14:15.336461772Z   File "/usr/lib/python3.10/pkgutil.py", line 421, in get_importer
2023-10-18T14:14:15.336464000Z     importer = path_hook(path_item)
2023-10-18T14:14:15.336466217Z   File "<frozen importlib._bootstrap_external>", line 1632, in path_hook_for_FileFinder
2023-10-18T14:14:15.336468383Z   File "<frozen importlib._bootstrap_external>", line 1504, in __init__
2023-10-18T14:14:15.336470552Z   File "<frozen importlib._bootstrap_external>", line 182, in _path_isabs
2023-10-18T14:14:15.336472757Z AttributeError: 'PosixPath' object has no attribute 'startswith'
2023-10-18T14:14:15.336474952Z
2023-10-18T14:14:15.336477128Z Cannot import /workspace/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite module for custom nodes: 'PosixPath' object has no attribute 'startswith'```
@Kosinkadink Kosinkadink changed the title On Ubuntu, get__ffmpeg_exe causes AttributeError: 'PosixPath' object has no attribute 'startswith' On Ubuntu, get_ffmpeg_exe causes AttributeError: 'PosixPath' object has no attribute 'startswith' Oct 20, 2023
@Kosinkadink
Copy link
Author

Kosinkadink commented Oct 21, 2023

Sorry for wasting your time if you started to look into this, issue was due to something entirely unrelated to image-ffmpeg, with other code messing with the sys.path and inserting an obj from Path instead of string, which caused the error on linux systems.

@Kosinkadink Kosinkadink closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2023
@almarklein
Copy link
Member

No problem, thanks nonetheless!

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

No branches or pull requests

2 participants