Python error when running DobotControl.py


#1

Hi!

I’m trying to run the Demo in Python 2.7 as well as 3.6 on Windows 64 bit. DobotDllType.py is running fine, but if I run DobotControl.py this error pops up:

api = dType.load()

  File "DobotDllType.py", line 459, in load
return CDLL("DobotDll.dll",  RTLD_GLOBAL)

  File "C:\Python\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)

WindowsError: [Error 193] %1 is not a valid Win32 application

Do you have any recommendations on how to solve this issue? I checked all software involved for the version and 64 bit.

Thank you in advance!


#2

Please email to support@dobot.cc to get technical support, thanks


#3

Same thing happen to me and to fix it download the python 3.5.0 x86 version
( [Windows x86 executable installer])


#4

So this particularly is the problem. The software involved (e.g. Anaconda) should be 32Bit.
Also, notice that Python Demo can only run at Python 3.5. I recently got exact the same issue, so here’s my way to solve it:

  1. Reinstall all software needed with 32-Bit version
  2. Create a virtual environment using
    conda create - n {your envs name here} python=3.5 anaconda
  3. Install all the other packages needed, if necessary, by pip.

Connect your Dobot, wait for the green LED to light up and you should be ready to go!


#5

I am using Pycharm with python 3.5.

I want to use dobot magician in a project where I have to sniff network packets with scapy.

Without scapy everything works fine.

But when I import anything from scapy (for example " from scapy.all import sniff") dobot magician stops working with a message:

Traceback (most recent call last):
File “E:/DelayLipSyncDAQ_V10-Pyt_35-32-Shark-Brez-MetricServer Database/Terminal_testing.py”, line 217, in
robotska_roka.connect_dobot()
File “E:\DelayLipSyncDAQ_V10-Pyt_35-32-Shark-Brez-MetricServer Database\Test_programs.py”, line 385, in connect_dobot
self.DobotM2 = dType.load()
File “E:\DelayLipSyncDAQ_V10-Pyt_35-32-Shark-Brez-MetricServer Database\DobotDllType.py”, line 458, in load
return CDLL(“DobotDll.dll”, RTLD_GLOBAL)
File “C:\Program Files (x86)\Python35-32\lib\ctypes_init_.py”, line 351, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

I would really appreciate any help how to use dobot magician with scapy.

Greetings from Slovenia


#6

Just to add: python 3.5 and pycharm are both 32bit versions.


#7

I have also faced the same python error when running the robot control so please help me to fix it. I have also checked chrome keeps crashing where I got a bit solution regarding this.


#8

I am running into this error “OSError: [WinError 193] %1 is not a valid Win32 application” in one variant of the code and not the other. I am using Pycharm 2019.1 and both are using the same python37.exe one fails and the other does not.
They have the same code line artist = dType.load(), (the name does not matter) and one runs and the other has the error???


#9

What I found was not what should not be happening. What corrected the problem with this error “OSError: [WinError 193] %1 is not a valid Win32 application” is that inside the function call “dType.load()” code needs the import statement, which is not required for my code to work, “from PyQt import QtCore, QtGui, QtWidgets” in my code.