Python Syntax Errors in Motorized Focus Camera scripts

I downloaded the 3 scripts from github today, extracted them, and ran them in the command line, and this is the result:

[email protected]:~ $ sudo python Motorized_Focus_Camera_Preview.py
File “Motorized_Focus_Camera_Preview.py”, line 16
if event.type ==KEYDOWN:
^
TabError: inconsistent use of tabs and spaces in indentation

[email protected]:~ $ sudo python Autofocus.py
Traceback (most recent call last):
File “Autofocus.py”, line 1, in <module>
import cv2 #sudo apt-get install python-opencv
ModuleNotFoundError: No module named ‘cv2’

[email protected]:~ $ sudo python Motorized_Focus_Camera_Snapshot.py
File “Motorized_Focus_Camera_Snapshot.py”, line 18
if event.type ==KEYDOWN:
^
TabError: inconsistent use of tabs and spaces in indentation
[email protected]:~ $

Can you help me out here? Thanks.

-Penny

Hi,

The python code need pygame module, which is not convenient. I have add a C version code just now. Please try to use the new code https://github.com/ArduCAM/RaspberryPi/tree/master/Motorized_Focus_Camera/C

This works perfectly. Thanks!

You are welcome. It is my duty to help you solve your problems.

Let me know if you need more help.