Skip to content
This repository was archived by the owner on May 5, 2024. It is now read-only.

the PythonicOS API

Charlie edited this page Jun 2, 2023 · 2 revisions

the PythonicOS API

what is the PythonicOS API?

the PythonicOS API is a set of python scripts that allow you to connect your scripts to the main pythonicOS script.

how do i use the PythonicOS API?

to use the PythonicOS API you need to import the towii.py file into your script.

import towii

then you can run

from towii import pydata1,pydata2

to import the data from the towii.py file.

the towii.py file contains these variables:

'''when calling pydata1.send() it will send the data to pydata2.recv() and vice versa, there is a total of 100 pydata sockets you can send data to and from'''
pydata1, pydata2 = socket.socketpair()
'''when calling time from time2 you will recive the system time in UNIX format'''
time1, time2 = socket.socketpair()
'''with the wait socket, you can use it like a normal socket to send data too and from, but you can also use it to halt any program with a certain header'''
wait1, wait2 = socket.socketpair()
'''the start socket is used to start any program with a certain header'''
start1, start2 = socket.socketpair()
'''the stop socket is used to stop any program with a certain header'''
stop1, stop2 = socket.socketpair()
'''the cont socket is used to continue any program with a certain header'''
cont1,cont2  = socket.socketpair()
'''the halt socket is used to halt any program with a certain header'''
halt1, halt2 = socket.socketpair()

you can send data over the socket by using the pydata1.saend() function or a similar function for the socket your using.

pydata1.send("hello world")

then on the reciving end you can use the pydata2.recv() function or a similar function for the socket your using.

pydata2.recv(1024)

you can also use the time socket to get the system time in UNIX format.

import time
time = time.time()
time1.send(time)

then on the reciving end you can use the time2.recv() function or a similar function for the socket your using.

time2.recv(1024)

hey! how are you?

welcome to the forum! hope your having a great time!

Clone this wiki locally