apes-together-strong
apes-together-strong

Reputation: 67

Missing dll, no idea what's wrong

Half a year ago I was playing around with someone else's code and it worked fine. I left it alone because a dependency stopped working and it was useless, but today I went back to it to see if it still works. Surprise, surprise, it doesn't, but the reason is strange:

Error loading Python DLL 'D:\REDACTED\binaries\python38.dll'.
LoadLibrary: The specified module could not be found.

This is the code of the part that's having problems:

import os
import subprocess
import sys

mpdurl = "REDACTED"

currentFile = __file__
realPath = os.path.realpath(currentFile)
dirPath = os.path.dirname(realPath)
dirName = os.path.basename(dirPath)

youtubedlexe = dirPath + '/binaries/yt-dlp.exe'
aria2cexe = dirPath + '/binaries/aria2c.exe'
mp4decryptexe = dirPath + '/binaries/mp4decrypt_new.exe'
mkvmergeexe = dirPath + '/binaries/mkvmerge.exe'
ffmpegexe = dirPath + '/binaries/ffmpeg.exe'

subprocess.run([youtubedlexe, '-k', '--allow-unplayable-formats', '--no-check-certificate', '-f', 'ba', '--fixup', 'never', mpdurl, '-o', 'encrypted.m4a', '--external-downloader', aria2cexe, '--external-downloader-args', '-x 16 -s 16 -k 1M'])
subprocess.run([youtubedlexe, '-k', '--allow-unplayable-formats', '--no-check-certificate', '-f', 'bv', '--fixup', 'never', mpdurl, '-o', 'encrypted.mp4', '--external-downloader', aria2cexe, '--external-downloader-args', '-x 16 -s 16 -k 1M']) 

I've tried upgrading, reinstalling and downgrading to 3.8, downloading those dlls from the net, removing the environment variables and googling but no cigar. I had the newest version and 3.9 on my PC, then uninstalled them both and installed 3.8 but it didn't work, same thing.

EDIT:

it was a stupid problem with yt-dlp itself, for some reason this only works with an older version. thanks to mr sami-amer for trying to help.

Upvotes: 1

Views: 987

Answers (2)

apes-together-strong
apes-together-strong

Reputation: 67

it was a stupid problem with yt-dlp itself, for some reason this only works with an older version. thanks to mr sami-amer for trying to help.

Upvotes: 1

sami-amer
sami-amer

Reputation: 274

Have you tried using a virtual environment, with pyenv or conda, with only python 3.8? Additionally, are you sure you are calling the correct python?

Someone else had a similar problem, but sadly they fixed it and never shared the answer. From that question however, it might be safe to assume that this is related to python itself.

First: If you are running this through vscode and the play button at the top right, make sure vscode is in the right environment/using the right python. You can do this by looking at the bottom right of the window, where it will say something like Python | 3.10.0.

Second: If you are running from a terminal, make sure you are using the correct python command. Until the latest update, MacOS by default uses 2.7 when using python. Additionally, python3 and python3.10 will sometimes use completely different environments. This gets complicated when you don't use a virtual env

Third: Create a virtual environment. I suggest using conda, but pyenv also works. After you install one of these, create a new environment and specify python=3.8. Then, use --version to make sure it worked. Run python --version, python3.8 --version, python3 --version and see which one returns 3.8.X. That should be the one you use.

This is about the extent of help anyone can give, I think, without knowing how you are trying to run the script and what your environment is. Additionally, what part of your code block throws an error? Is it the subprocess call? Or the parts before it?

One last question: Looking around online I see that this seems to be a common error with exes compiled with pyinstaller. Any chance you are running a compiled script?

I know some of these solutions sound really basic, but I often forget to do them myself, and it never hurts to eliminate solutions.

Upvotes: 1

Related Questions