I have created the following Python 3 module named resource.py, with two functions, Read_Cursor and Write_Cursor. When I import the module, I get an error, depending on how I import the module.
I have tried:
import resource
from resource import *
Read_Cursor=resource.Read_Cursor
resource.py:
def Write_Cursor(Cursor):
with open("/run/thermostat/Cursor","w") as f: # Set the Cursor position
def Read_Cursor():
with open("/run/thermostat/Cursor","r") as f: # Get the Cursor position
C = int(f.read())
return C
Error:
Traceback (most recent call last):
File "./index.py", line 6, in <module>
import resource
File "/usr/lib/cgi-bin/resource.py", line 5
def Read_Cursor():
^
IndentationError: expected an indented block