-1

I'm trying to change my .py file to .exe however I get the above error when I try to run it. It seems to compile fine with Pyinstaller. I used pyinstaller filename.spec -F -i "pic.ico" my filename.spec is below I've tried several solutions on stackoverflow but can't seem to find the right one. It seems to think that the .dll file is in that directory however the _MEI74002 folder doesn't exist there. When I run filename.py it works perfectly. The actual path for the .dll file is in the datas variable. I don't understand why it's not checking in there.

a = Analysis(['Filename.py'],
         pathex=['Path\\To\\Python\\File'],
         binaries=[('C:\\Users\\PycharmProjects\\iProdi2\\chromedriver.exe', '.\\selenium\\webdriver')],
         datas=[('C:\\Users\\AppData\\Local\\Programs\\Python\\Python38\\Lib\\site-packages\\autoit\\lib\\AutoItX3_x64.dll', '.')], #This is where my .dll file is actually stored
         hiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher,
         noarchive=False)

Edit: I want to distribute my program to other computers so I would like for the .dll file to be a part of the .exe application so the users don't have to download anything.

Edit2: I've got the below error when running the program after putting debug = True, strip=None, upx=True,console=True. I still don't understand what's wrong. I knew it was something wrong with the autoit library before but wasn't sure about how to resolve it.

File "filename.py", line 18, in <module>
from autoit import control_send
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\autoit\__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 621, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\autoit\autoit.py", line 26, in <module>
OSError: Cannot load AutoItX from path: 
C:\Users\AppData\Local\Temp\_MEI179202\autoit\lib\AutoItX3_x64.dll
[22596] Failed to execute script filename
9
  • 1
    Read How do I debug a non-functioning PyInstaller build? Commented Jan 17, 2020 at 14:40
  • Are you saying that to check if the library is installed correctly? Because the script works so I would have thought that it was installed correctly. Commented Jan 17, 2020 at 14:52
  • 1
    " the script works": The given link is not about the script, it's about to get the reason why the .exe fails. " library is installed correctly?": You install into root by '.', I doubt the packages is not searching there. Commented Jan 17, 2020 at 14:59
  • Also the dependency walker runs on Windows 95, 98, Me, NT, 2000, XP, 2003, Vista, 7, and 8. So not sure if it'll work on Windows 10. Commented Jan 17, 2020 at 14:59
  • 1
    "OSError: Cannot load AutoItX from path:": Change '.' to 'autoit\\lib' Commented Jan 17, 2020 at 16:41

1 Answer 1

1

"OSError: Cannot load AutoItX from path:": Change '.' to 'autoit\lib' – stovfl 31 mins ago

From my understanding the MEI... folder is a temporary folder and I was putting the .dll file into it by '.' when it should have been in the autoit\lib subfolder. So all I had to do was what stovfl said to do above. Thanks for the help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.