Skip to content

Windows build hardcodes "C:\tools\fluidsynth\bin" causing FileNotFoundError #121

@zhangpanyang

Description

@zhangpanyang

Version: 1.3.4
OS: Windows 11

Problem

When importing fluidsynth on Windows with Python 3.8:

import fluidsynth

It raises

FileNotFoundError: [WinError 3] The system cannot find the specified path: 'C:\\tools\\fluidsynth\\bin'

This is caused by the lines in fluidsynth.py:

# DLL search method changed in Python 3.8
# https://docs.python.org/3/library/os.html#os.add_dll_directory
if hasattr(os, 'add_dll_directory'):  # Python 3.8+ on Windows only
    os.add_dll_directory(os.getcwd())
    os.add_dll_directory('C:\\tools\\fluidsynth\\bin')
    # Workaround bug in find_library, it doesn't recognize add_dll_directory
    os.environ['PATH'] += ';C:\\tools\\fluidsynth\\bin'

This will fail if C:\\tools\\fluidsynth\\bin does not exist on the user's machine.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions