CIRCUITPYTHONPROGRAMMING/MICROPYTHON / CIRCUITPYTHON
To install SQL driver for Python. You can connect to a SQL Database using Python on Windows, Linux, or Mac. Getting Started. There are several python SQL drivers available. However, Microsoft places its testing efforts and its confidence in pyodbc driver. Choose a driver, and configure your development environment accordingly: Python SQL driver. Audio in Python. This page tries to provide a starting point for those who want to work with audio in combination with Python. If you are creating a game, most of what you are looking for may already be included in the many PythonGameLibraries that are available. If you are looking for podcasts related to Python, go to the PythonAudioMaterial page. Built in modules. Mar 06, 2005 Many apps have user preferences and settings stored in a.plist (property list) file, which resides in the Library Preferences folder, unaffected by updates to the app itself. Some apps also store. The User Library is where all of your own presets, defaults, clips, default Live Sets and more are stored. The User Library is separate from the Core Library content so that it can be easily backed up, or shared between different Live installations or computers. The Python installers for the Windows platform usually include the entire standard library and often also include many additional components. For Unix-like operating systems Python is normally provided as a collection of packages, so it may be necessary to use the packaging tools provided with the operating system to obtain some or all of the.
As we continue to develop CircuitPython and create new releases, we will stop supporting older releases. Visit https://circuitpython.org/downloads to download the latest version of CircuitPython for your board. You must download the CircuitPython Library Bundle that matches your version of CircuitPython. Please update CircuitPython and then visit https://circuitpython.org/libraries to download the latest Library Bundle.
Each CircuitPython program you run needs to have a lot of information to work. The reason CircuitPython is so simple to use is that most of that information is stored in other files and works in the background. These files are called libraries. Some of them are built into CircuitPython. Others are stored on your CIRCUITPY drive in a folder called lib. Part of what makes CircuitPython so awesome is its ability to store code separately from the firmware itself. Storing code separately from the firmware makes it easier to update both the code you write and the libraries you depend.
Your board may ship with a lib folder already, it's in the base directory of the drive. If not, simply create the folder yourself. When you first install CircuitPython, an empty lib directory will be created for you.
CircuitPython libraries work in the same way as regular Python modules so the Python docs are a great reference for how it all should work. In Python terms, we can place our library files in the lib directory because its part of the Python path by default.
One downside of this approach of separate libraries is that they are not built in. To use them, one needs to copy them to the CIRCUITPY drive before they can be used. Fortunately, we provide a bundle full of our libraries.
Our bundle and releases also feature optimized versions of the libraries with the .mpy file extension. These files take less space on the drive and have a smaller memory footprint as they are loaded.
We're constantly updating and improving our libraries, so we don't (at this time) ship our CircuitPython boards with the full library bundle. Instead, you can find example code in the guides for your board that depends on external libraries. Some of these libraries may be available from us at Adafruit, some may be written by community members!
Either way, as you start to explore CircuitPython, you'll want to know how to get libraries on board.
You can grab the latest Adafruit CircuitPython Bundle release by clicking the button below.
Note: Match up the bundle version with the version of CircuitPython you are running - 3.x library for running any version of CircuitPython 3, 4.x for running any version of CircuitPython 4, etc. If you mix libraries with major CircuitPython versions, you will most likely get errors due to changes in library interfaces possible during major version changes.
If you need another version, you can also visit the bundle release page which will let you select exactly what version you're looking for, as well as information about changes.
Either way, download the version that matches your CircuitPython firmware version. If you don't know the version, look at the initial prompt in the CircuitPython REPL, which reports the version. For example, if you're running v4.0.1, download the 4.x library bundle. There's also a py bundle which contains the uncompressed python files, you probably don't want that unless you are doing advanced work on libraries.
After downloading the zip, extract its contents. This is usually done by double clicking on the zip. On Mac OSX, it places the file in the same directory as the zip.
Open the bundle folder. Inside you'll find two information files, and two folders. One folder is the lib bundle, and the other folder is the examples bundle.
Now open the lib folder. When you open the folder, you'll see a large number of mpy files and folders
Example Files
All example files from each library are now included in the bundles, as well as an examples-only bundle. These are included for two main reasons:
- Allow for quick testing of devices.
- Provide an example base of code, that is easily built upon for individualized purposes.
First you'll want to create a lib folder on your CIRCUITPY drive. Open the drive, right click, choose the option to create a new folder, and call it lib. Then, open the lib folder you extracted from the downloaded zip. Inside you'll find a number of folders and .mpy files. Find the library you'd like to use, and copy it to the lib folder on CIRCUITPY.
This also applies to example files. They are only supplied as raw .py files, so they may need to be converted to .mpy using the mpy-cross utility if you encounter
MemoryErrors
. This is discussed in the CircuitPython Essentials Guide. Usage is the same as described above in the Express Boards section. Note: If you do not place examples in a separate folder, you would remove the examples from the import
statement.If you choose to load libraries as you need them, you may write up code that tries to use a library you haven't yet loaded. We're going to demonstrate what happens when you try to utilise a library that you don't have loaded on your board, and cover the steps required to resolve the issue.
This demonstration will only return an error if you do not have the required library loaded into the lib folder on your CIRCUITPY drive.
Let's use a modified version of the blinky example.
Download:file
![Stored Stored](/uploads/1/2/6/0/126030088/442261776.png)
Save this file. Nothing happens to your board. Let's check the serial console to see what's going on.
We have an
ImportError
. It says there is no module named 'simpleio'
. That's the one we just included in our code!Click the link above to download the correct bundle. Extract the lib folder from the downloaded bundle file. Scroll down to find simpleio.mpy. This is the library file we're looking for! Follow the steps above to load an individual library file.
The LED starts blinking again! Let's check the serial console.
No errors! Excellent. You've successfully resolved an
ImportError
!If you run into this error in the future, follow along with the steps above and choose the library that matches the one you're missing.
If you have a Trinket M0 or Gemma M0, you'll want to follow the same steps in the example above to install libraries as you need them. You don't always need to wait for an
ImportError
as you probably know what library you added to your code. Simply open the lib folder you downloaded, find the library you need, and drag it to the lib folder on your CIRCUITPY drive.You may end up running out of space on your Trinket M0 or Gemma M0 even if you only load libraries as you need them. There are a number of steps you can use to try to resolve this issue. You'll find them in the Troubleshooting page in the Learn guides for your board.
Python
Libraries and examples are updated from time to time, and it's important to update the files you have on your CIRCUITPY drive.
To update a single library or example, follow the same steps above. When you drag the library file to your lib folder, it will ask if you want to replace it. Say yes. That's it!
A new library bundle is released every time there's an update to a library. Updates include things like bug fixes and new features. It's important to check in every so often to see if the libraries you're using have been updated.
This guide was first published on Dec 19, 2017. It was lastupdated on Dec 19, 2017.This page (CircuitPython Libraries) was last updated on Apr 10, 2020.ARDUINO COMPATIBLES/LEARN ARDUINOARDUINO COMPATIBLES/ADAFRUIT METRO
The Library Manager is the simplest and safest way to install libraries. If possible, that is the method you should use.
If the library you want to use is not available via the library manager, you can get the source code and place it into your machine's local library folder. The location of the folder is rather specific.
See the file hierarchy below:
It is important to install your libraries in the correct location. Otherwise the compiler will not be able to locate them when you try to compile and upload your sketches.
Incorrectly installed libraries can cause many problems with the IDE.
Locate your Sketchbook Folder and the Libraries Folder Inside
Your sketchbook folder is the folder where the Arduino IDE stores your sketches. This folder is automatically created by the IDE when you install it.
On Linux machines, the folder is named 'Sketchbook' and it is typically located in /home/
On Windows and Macintosh machines, the default name of the folder is 'Arduino' and is located in your Documents folder.
On Linux machines, the folder is named 'Sketchbook' and it is typically located in /home/
On Windows and Macintosh machines, the default name of the folder is 'Arduino' and is located in your Documents folder.
This is a common source of confusion on Windows and Mac machines, your sketchbook folder is not named 'sketchbook' it is named 'Arduino'!
![Stored Stored](/uploads/1/2/6/0/126030088/289623726.jpg)
User installed libraries should go in a folder named Libraries, located inside your sketchbook folder. This is where the IDE will look for user installed libraries.
On version 1.0.2 and later of the Arduino IDE, the 'Libraries' folder is created automatically. On earlier versions of the IDE, you may need to create it when you install your first library.
Open the Preferences DialogClick File -> Preferences in the IDE. |
Find the Sketchbook LocationUsually a folder named Arduino in your Documents folder. Once you know the location, navigate to this folder in Windows Explorer or mac Finder |
Create a Libraries FolderIf there is no Libraries folder there, create one. Right click in Windows Explorer and select New -> Folder. |
Rename to LibrariesRight click on the New Folder and select Rename. Then type in Libraries. |