2021年2月5日星期五

Py2Exe - Modules Not Found

After running python setup.py py2exe I get an error message:

15 missing Modules    ------------------  ? Cookie                              imported from youtube_dl.compat  ? Crypto                              imported from youtube_dl.downloader.hls  ? Cryptodome                          imported from youtube_dl.extractor.ivi  ? HTMLParser                          imported from youtube_dl.compat  ? _posixshmem                         imported from multiprocessing.resource_tracker, multiprocessing.shared_memory  ? cookielib                           imported from youtube_dl.compat  ? pkg_resources.extern.appdirs        imported from pkg_resources  ? pkg_resources.extern.packaging      imported from pkg_resources  ? pkg_resources.extern.six            imported from pkg_resources  ? readline                            imported from cmd, code, pdb  ? urllib.urlretrieve                  imported from youtube_dl.compat  ? xattr                               imported from youtube_dl.utils  ? youtube_dl.extractor.lazy_extractors imported from youtube_dl.extractor  ? youtubesearchpython.handlers        imported from youtubesearchpython.legacy  ? youtubesearchpython.internal        imported from youtubesearchpython, youtubesearchpython.extras, youtubesearchpython.legacy, youtubesearchpython.search, youtubesearchpython.streamurlfetcher  Building 'dist\sad.exe'.  error: [WinError 87] The parameter is incorrect.  

My setup.py contains the following:

# setup.py  from distutils.core import setup  import py2exe     setup(      console=['downloader.py'],      options = {          'py2exe': {              "packages": ['youtubesearchpython']          }      }      )  

My donloader.py file contains the following:

from youtubesearchpython import VideosSearch            title = 'song name'    videosSearch = VideosSearch(title, limit = 2)            print(videosSearch.result())             url = videosSearch.result()["result"][0]["link"]  name = videosSearch.result()["result"][0]["title"]  id = videosSearch.result()["result"][0]["id"]          from mhyt import yt_download    yt_download(url, id + ".mp4")    myfile = open(id + '.mp4')    file = id + '.mp4'        print(id)            import time  from pynput.keyboard import Key, Controller    keyboard = Controller()    keyboard.press(Key.cmd)  keyboard.press('e')  keyboard.release(Key.cmd)  keyboard.release('e')  time.sleep(0.3)        keyboard.press(Key.ctrl)  keyboard.press('f')  keyboard.release(Key.ctrl)  keyboard.release('f')  time.sleep(0.6)    keyboard.type(id + '.mp4')      keyboard.press(Key.down)  keyboard.release(Key.down)      keyboard.press(Key.enter)  keyboard.release(Key.enter)  

I tried to run py2exe on a very basic python program: print(1+1) that doesn't need any modules to run and still got a similar error:

  2 missing Modules    ------------------  ? _posixshmem                         imported from multiprocessing.resource_tracker, multiprocessing.shared_memory  ? readline                            imported from cmd, code, pdb  Building 'dist\hello.exe'.  error: [WinError 87] The parameter is incorrect.  

Anything that would help me fix the "missing modules" error would be appreciated!

Thank you!

https://stackoverflow.com/questions/66072911/py2exe-modules-not-found February 06, 2021 at 10:04AM

没有评论:

发表评论