Write own code for uArm Swift Pro

Hi,

I’m very new to programming robots. But I have to do one for my internship. So here is what I got:

I got an uArm Swift Pro, which works from the uArmStudio and from the Arduino IDE via the serial monitor by entering GCode.
Now I Should send scripts/code/functions to the uArm via Python.

I tried two ways:
1.) I tried to ad a new python file to the uArm Python SDK which i downloaded from github.
Code looks like this:
sdk

My problem here is that i have no clue how i could “talk” with my uArm.

Therefore i tried
2.) using pyserial
There i successfully connected the python shell with the uarm (it made this beep sound) .
Code looks like this:

import serial
ser = serial.Serial(‘COM4’,9600)

but when i tried ser.write(“M2232 V1”) i got this error message:
Traceback (most recent call last):
File “<pyshell#2>”, line 1, in
ser.write(“M2232 V1”)
File “C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyserial-3.4-py3.7.egg\serial\serialwin32.py”, line 308, in write
data = to_bytes(data)
File “C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyserial-3.4-py3.7.egg\serial\serialutil.py”, line 63, in to_bytes
raise TypeError(‘unicode strings are not supported, please encode to bytes: {!r}’.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: ‘M2232 V1’

Can someone help me?

Thanks in advance.
Regards,

Kathrin