Skip to content

OSError: [WinError 193] %1 is not a valid Win32 application #15

@HatScripts

Description

@HatScripts

Get this error every time I try to import unrar:

Traceback (most recent call last):
  File "D:/IdeaProjects/Python/Downloader/archive.py", line 6, in <module>
    from unrar import rarfile
  File "%LocalAppData%\Programs\Python\Python36\lib\site-packages\unrar\rarfile.py", line 26, in <module>
    from unrar import unrarlib
  File "%LocalAppData%\Programs\Python\Python36\lib\site-packages\unrar\unrarlib.py", line 45, in <module>
    unrarlib = ctypes.WinDLL(lib_path)
  File "%LocalAppData%\Programs\Python\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

What I've tried:

  • Installing UnRAR via the exe found at https://www.rarlab.com/rar/UnRARDLL.exe and then adding the C:\Program Files (x86)\UnrarDLL to the system PATH. Also tried setting UNRAR_LIB_PATH to C:\Program Files (x86)\UnrarDLL, C:\Program Files (x86)\UnrarDLL\UnRAR.dll, etc.
  • Manually extracting UnRAR.dll from said exe and pointing UNRAR_LIB_PATH to it. Tried the same also with UnRAR64.dll.
  • Renaming the installer exe to unrar.dll and adding it to PATH (lol i give up)

Edit: Just realised the last commit was in 2016. That was a waste of 2 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions