467,216 Members | 1,072 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

Trying out two small Pythons (pymite and tinypy)

Expert 100+
I have built two very small pythons (pymite and tinypy) where one is not maintained anymore. The following summarises the experience.


I found the most recent version : https://github.com/dwhall/p14p

It is a Python for microcontrollers. I don't have one, so I will build it for my Windows 10, with an Ubuntu installed from Microsoft store.

I downloaded the archive as a zip file, unzip it into the directory p14p-master. I type 'make' to build it.

I get some error about comparing pointer to int. To fix this, I locate -Werror in the Makefile

pymite requires Python 2.6 (the project have been inactive for some time). I don't want to replace my existing Python with Python 2.6 by installing it, therefore I download Python 2.6 from the source: https://www.python.org/downloads/ and place it in the newly unpacked p14p-master directory

I unpack it, go into the directory, then type:

Expand|Select|Wrap|Line Numbers
  1. ./configure & make.
I note the location of my newly built python.exe file, i.e., /p14p-master/python2.6/python.exe, then I go into each of the python files in the tools directory and replace #!/usr/bin/env python with /p14p-master/python2.6/python.exe in each .py file in the pymite project. I type make, go to the directory in p14-master/src/tools/ and type:

Expand|Select|Wrap|Line Numbers
  1. ./ipm.py -f ../platform/desktop64/pmfeatures.py -d
Now you could type: print "hello world"

it is a bit annoying to type stuff directly to stdin, so if we have a python file, say "test1.py" with a python program, you could type :

Expand|Select|Wrap|Line Numbers
  1. load test1.py
from within pymite to load and execute the test1.py.

It seems that it doesn't contain a parser and takes the bytecodes from my python 2.6 program (i.e., the .pyc) file and execute them so one could argue that pymite is more a virtual machine.


It can be found here:http://www.tinypy.org/downloads.html

build it by downloading the zip file, unzip it, then type:

Expand|Select|Wrap|Line Numbers
  1. python build.py
it runs several test, and explain that you could run python programs like this:

Expand|Select|Wrap|Line Numbers
  1. ./tinypy <your program>
(it doesn't seem to allow you to type in directly into stdin, so you need to store your program into a file)

A statement such as print "hello world", doesn't output anything, however changing it to print("hello world") does. So I guess tinypy was more inspired by Python 3, while pymite was inspired by Python 2.
May 12 '20 #1
  • viewed: 5475

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by ForHimself Every Man | last post: by
12 posts views Thread by f29 | last post: by
5 posts views Thread by Mathias Panzenboeck | last post: by
1 post views Thread by tedpottel@gmail.com | last post: by
14 posts views Thread by rtk | last post: by
6 posts views Thread by tedpottel@gmail.com | last post: by
2 posts views Thread by tedpottel@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.