asweigart / asweigart/pyaudacity

PyAudacity not connecting to Audacity on latest Windows due to pipe issue with `os.path.exists`

Open
#13 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
38
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Hi, pyaudacity isn't working for me with the latest Audacity and Windows installations on my machine. Based on some debugging, it looks like the `os.path.exists` check that runs at the beginning of the code causes the file handle to get locked up, which prevents the program from recognizing that the pipe actually exists and proceeding forward.

Ref links:
- https://stackoverflow.com/questions/51255352/why-does-os-path-exists-stop-windows-named-pipes-from-connecting
- https://forum.audacityteam.org/t/different-errors-running-pipe-test/65305/44

To get around this issue and make PyAudacity work, I had to comment out the original `os.path.exists` checks at the start of PyAudacity. After that, pyaudacity started working again as expected.

Since it's not clear if this library is still maintained, I've made a fork of this repo and deployed my own package to PyPI with the fix implemented. For anyone else seeing this issue later, you can download [the fixed package](https://pypi.org/project/PyAudacity-x/0.1.4/) like so:
```
pip install PyAudacity-x==0.1.4
```
This is a drop-in replacement, so just install it and your existing pyaudacity scripts should continue working as normal

Here's a code diff for your inspection if you want: [link](https://github.com/asweigart/pyaudacity/compare/main...takanuva15:pyaudacity-x:main)

If anyone else can replicate the issue, please comment here so others are aware. (If this library is updated to fix the issue, I'll update my fork to copy the original)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the beginning of PyAudacity for the os.path.exists checks described in the report and compare the linked fork diff. Reproduce the connection attempt with the latest Audacity on Windows, then confirm that the pipe connects without the existence check locking the handle.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.