# Isrcsubmit.py fix for Windows Python 3.8+: Could not find module 'discid.dll'

**URL:** https://community.metabrainz.org/t/isrcsubmit-py-fix-for-windows-python-3-8-could-not-find-module-discid-dll/630230
**Category:** MusicBrainz
**Tags:** windows, isrc, isrcsubmit, python
**Created:** [March 28, 2023, 9:34am UTC](https://community.metabrainz.org/t/isrcsubmit-py-fix-for-windows-python-3-8-could-not-find-module-discid-dll/630230 "2023-03-28T09:34:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jesus2099](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jesus2099/32/36_2.png) [@jesus2099](https://community.metabrainz.org/u/jesus2099)
#### Post date: [March 28, 2023, 9:34am UTC](https://community.metabrainz.org/t/isrcsubmit-py-fix-for-windows-python-3-8-could-not-find-module-discid-dll/630230/1 "2023-03-28T09:34:50Z")

</div>

I was annoyed for a few month, after my laptop had been reset, I couldn’t use @JonnyJD [musicbrainz-isrcsubmit.py](http://jonnyjd.github.io/musicbrainz-isrcsubmit/) anymore on _my_ laptop.

As I got the problem on my recent Windows installation, it seems that, without this fix, no recent Windows environment would run the tool, anymore:

> <https://github.com/JonnyJD/musicbrainz-isrcsubmit/issues/143>
>
> Now that \*\*my laptop has been completely reset\*\*, it does not work.
> Maybe \[last… time, it worked\](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/127#issuecomment-841734934) thanks to pre-existing stuff.
> 
> Now I get this error:
> 
> \`\`\`
> C:\\Users\\bob\\Documents\\PRG\\DOS\\isrcsubmit-2.1.1-beta-win64\>isrcsubmit.bat
> Traceback (most recent call last):
> File "C:\\Users\\bob\\Documents\\PRG\\DOS\\isrcsubmit-2.1.1-beta-win64\\isrcsubmit.py", line 47, in \<module\>
> import discid
> File "C:\\Users\\bob\\Documents\\PRG\\DOS\\isrcsubmit-2.1.1-beta-win64\\discid\\\_\_init\_\_.py", line 30, in \<module\>
> from discid.disc import read, put, Disc, DiscError, TOCError
> File "C:\\Users\\bob\\Documents\\PRG\\DOS\\isrcsubmit-2.1.1-beta-win64\\discid\\disc.py", line 24, in \<module\>
> from discid.libdiscid import \_LIB, FEATURES
> File "C:\\Users\\bob\\Documents\\PRG\\DOS\\isrcsubmit-2.1.1-beta-win64\\discid\\libdiscid.py", line 108, in \<module\>
> \_LIB = \_open\_library(\_LIB\_NAME)
> File "C:\\Users\\bob\\Documents\\PRG\\DOS\\isrcsubmit-2.1.1-beta-win64\\discid\\libdiscid.py", line 99, in \_open\_library
> return ctypes.cdll.LoadLibrary(lib\_name)
> File "C:\\Users\\bob\\AppData\\Local\\Programs\\Python\\Python310\\lib\\ctypes\\\_\_init\_\_.py", line 452, in LoadLibrary
> return self.\_dlltype(name)
> File "C:\\Users\\bob\\AppData\\Local\\Programs\\Python\\Python310\\lib\\ctypes\\\_\_init\_\_.py", line 374, in \_\_init\_\_
> self.\_handle = \_dlopen(self.\_name, mode)
> FileNotFoundError: Could not find module 'discid.dll' (or one of its dependencies). Try using the full path with constructor syntax.
> \`\`\`
> 
> Although there is a \`discid.dll\` file in the \`isrcsubmit-2.1.1-beta-win64\` folder.
> 
> My new PR #144, based on @omgitsraven, would fix this ticket without breaking other OS and older Python.

> _Could not find module ‘discid.dll’_

On Windows, it only works now on my old desktop Windows XP 2002 SP3 32 bits with Python 3.4.3 but not on my more recent professional laptop Windows 11 64 bits with Python 3.10.7!

I am using version 2.1.1 beta zip files (for the Windows 64 bits DLL), that can apparently only be found in a hidden unlinked page! [http://isrcsubmit.jonnyjd.net/downloads/](http://isrcsubmit.jonnyjd.net/downloads/)

On Linux, no problems on my desktop Debian 11 64 bits with Python 3.9.2.

I found [an old bug fix for Windows Python 3.8+](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/125) by @RavenWorks that makes my recent Windows run properly!  
But it makes the other platforms (Linux and Windows Python 3.7-) fail.

So I resubmitted this abandoned fix but surrounding the fix by conditional statements, so that it only runs when needed (Windows OS **and** Python 3.8+):

> <https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/144>
>
> Fixes https://github.com/JonnyJD/musicbrainz-isrcsubmit/issues/143 (Windows Pyth…on 3.8+ \*\*\_Could not find module 'discid.dll'\_\*\*), without tampering with other setups.
> 
> This https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/125 fix from @omgitsraven was NG for Python 3.7 and less, while OK for Python 3.8+.
> I found how to test Python version with https://stackoverflow.com/a/3016198/2236179 and I also test if script is running in Windows.
> 
> Tested on Linux (condition not met, do the script runs good as usual) and Windows Python 3.10.1 (condition met, fixes #143 and now the script is running good).
> The script works in both cases.
> 
> I no longer have old python version but I have tested my version condition and it should work to prevent the new line in python 3.7 and earlier.
> 
> Then something must be done to bump version number and to publish new version zip files.
> 
> \## PATCH
> 
> If you want to test in your environment, the patch is to insert the following code, before the first \`try\` of the script:
> 
> \`\`\`py
> \# Windows Python 3.8+ scan current folder for discid.dll
> if os.name == "nt" and sys.version\_info \>= (3,8):
> os.add\_dll\_directory(os.getcwd())
> \`\`\`
> 
> 
> \## TEST
> 
> | OS | Python | 2.1.1-beta | Patched 2.1.1-beta | 3.0.0-dev | Patched 3.0.0-dev |
> |--------------------|--------|------------|--------------------|-----------|-------------------|
> | Debian 11 64 bits | 3.9.2 | :+1: | :+1: | :+1: | :+1: |
> | Windows XP 32 bits | 3.4.3 | :+1: | :+1: | :+1: | :+1: |
> | Windows 11 64 bits | 3.10.7 | :x: | :+1: | :x: | :+1: |

(see GitHub pull/merge request above for updated test table)

| OS | Python | 2.1.1-beta | Patched 2.1.1-beta | 3.0.0-dev | Patched 3.0.0-dev |
| --- | --- | --- | --- | --- | --- |
| Debian 11 64 bits | 3.9.2 | 👍 | 👍 | 👍 | 👍 |
| Windows XP 32 bits | 3.4.3 | 👍 | 👍 | 👍 | 👍 |
| Windows 11 64 bits | 3.10.7 | ❌ | 👍 | ❌ | 👍 |

@Freso and @JonnyJD then, if you could have a look at my merge request.  
And if it is merged, there is apparently more to do then to make the new ( ~~2.2?~~ **3.0.0** ) version available to the public in the [OHP downloads](http://jonnyjd.github.io/musicbrainz-isrcsubmit/download) and in [GitHub releases](https://github.com/JonnyJD/musicbrainz-isrcsubmit/releases).  
Because in those both public places, the latest **2.1.1-beta** is not available yet.

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jesus2099/32/36_2.png) [@jesus2099](https://community.metabrainz.org/u/jesus2099)
#### Post date: [March 29, 2023, 8:10am UTC](https://community.metabrainz.org/t/isrcsubmit-py-fix-for-windows-python-3-8-could-not-find-module-discid-dll/630230/2 "2023-03-29T08:10:25Z")

</div>

For info, @yvanzo I put it back from #MusicBrainz Picard to #MusicBrainz because [isrcsubmit tools](https://wiki.musicbrainz.org/ISRC#Resources) are not related to Picard.

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jesus2099/32/36_2.png) [@jesus2099](https://community.metabrainz.org/u/jesus2099)
#### Post date: [August 9, 2023, 11:08pm UTC](https://community.metabrainz.org/t/isrcsubmit-py-fix-for-windows-python-3-8-could-not-find-module-discid-dll/630230/3 "2023-08-09T23:08:51Z")

</div>

Hi @Freso @JonnyJD.

I have a new 64-bit Windows 10 Pro, here.  
I installed isrcsubmit [from the website](http://jonnyjd.github.io/musicbrainz-isrcsubmit/download) but I still had to manually apply 3 work-arounds:

1. Overwrite `discid.dll` with 64-bit version\*  
[PR #127 (32/64 bit)](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/127) is merged but the download zip is still the old one that cannot run on 64-bit
2. Edit `isrcsubmit.py` to tell it to scan current folder to find `discid.dll`  
[PR #144](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/144) is waiting to be reviewed/merged
3. NEW! Edit `isrcsubmit.bat` to prevent strange behaviour with terminal windows  
NEW! [PR #145](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/145) is waiting to be reviewed/merged

\* Oh I now see that `isrcsubmit-2.1.1-beta-win64.zip` is available in hidden secret [http://isrcsubmit.jonnyjd.net/downloads/](http://isrcsubmit.jonnyjd.net/downloads/) but not from the visible website download page.  
I guess this zip fixes my first work-around!  
But it should be made available for download.

* * *

Links fixed, thanks @kellnerd, because I’m on smartphone. 😅

---

<div class="post-metadata">

### Author: ![jesus2099](https://community.metabrainz.org/user_avatar/community.metabrainz.org/jesus2099/32/36_2.png) [@jesus2099](https://community.metabrainz.org/u/jesus2099)
#### Post date: [November 27, 2023, 7:19pm UTC](https://community.metabrainz.org/t/isrcsubmit-py-fix-for-windows-python-3-8-could-not-find-module-discid-dll/630230/5 "2023-11-27T19:19:33Z")

</div>

@Freso, could you have a look at the isrcsubmit PR?  
There are a few **small** ones on `isrcsubmit.bat` and `isrcsubmit.py` that would be great to review.

Today I have another new office laptop:

- Windows 10 Entreprise 22H2 x64
- Python 3.11.6
- Either `CMD.exe` or [Windows Terminal](https://github.com/microsoft/terminal)

I have to:

1. Download the **hidden** [http://isrcsubmit.jonnyjd.net/downloads/isrcsubmit-2.1.1-beta-win64.zip](http://isrcsubmit.jonnyjd.net/downloads/isrcsubmit-2.1.1-beta-win64.zip)
2. Patch `isrcsubmit.bat` with [Run in same terminal PR #145](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/145)
3. Patch `isrcsubmit.py` with [Windows Python 3.8+: Search current folder for discid.dll PR #144](https://github.com/JonnyJD/musicbrainz-isrcsubmit/pull/144)
