0
votes

I'm trying to run a python script where the first step involves calling in a DLL file from on my computer. When I use Anaconda's Spyder compiler, it works perfectly fine, but when I try to then run the same program from Windows Powershell, I always get this error:

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

Here's the section of code that's failing when I run it in Powershell

import ctypes

from ctypes import *

import os

import time

os.chdir("C:\\Tektronix\\RSA_API\\lib\\x64")

rsa = cdll.LoadLibrary("RSA_API.dll")

The error links to the "LoadLibrary" line within my code and then also shows an error in the ctypes file at line 356. But again, it works in Anaconda, so it's apparently not broken enough that it can't run at all. I don't know how to fix this, and I would like to be able to run it in Powershell eventually.

1

1 Answers

0
votes

Looks like 32bit vs 64bit issue. I'm assuming the RSA_API is an 64bit dll then what Python interpreter are you using? Reinstalling it to 64bit should solve the issue.