home mail us syndication

strftime gotcha

It turns out in Python 2.7 datetime.strftime can’t handle dates before 1900. e.g.

ValueError: year=1066 is before 1900; the datetime strftime() methods require year >= 1900


Another great tip from PyConUK.  Need your Python tests to interact with the file system?  Find using /tmp unsatisfactory, then why not mock file system files using pyfakefs.

Practical introduction to machine learning via Kaggle problems (Ezzeri Esa)

You can follow along the machine learning tutorial yourself using materials Ezzari Esa has shared at https://github.com/savarin/pyconuk-introtutorial

Syntax tip:


- comma usage is matrix/2D list slicing

The Software Sustainability Institute

PyConUK afforded me a great oppportunity to converse with fellow technicians, including those working in HE.  Carwyn, based at Bangor University, reminded me about the Software Sustainability Institute, based at the universities of Edinburgh, Manchester, Oxford and Southampton.  Whose aim is to support better research by helping researchers to build and use better software.


Micro Python – shrinking Python down to run on a micro controller (Damien George)

Damien George, a researcher at the University of Cambridge, has rewritten Python to be optimised for running on a micro controller.  For example, the small computers that you might find in your washing machine, sometimes only have 64kb of RAM, so are generally controlled by programs written in C.

MicroPython is implemented on Python 3 and includes the usual Python features, such as:

  • floating point
  • complex numbers
  • bignum
  • math apps
  • generators
  • classes

Uses 528 bytes of RAM at standing and MicroPython will run on various operating systems as well as bare metal.

There are some differences, like not redefining built-ins functions and Micro Python uses garbage collection.  For more information https://github.com/micropython/micropython/wiki/Differences

The open source project at: http://github.com/micropython has been well received with over 1200 stars and 170 forks.

The Pyboard

  • is Python on bare metal, USB port, SD card port, accelerometer, 192k RAM or can can run stand alone from a battery.
  • made by Geltech
  • £28 per board
  • Light version is coming that is a lot cheaper, expected to be around £20

More information: http://micropython.org/

Next entries »