Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

Python • Re: How to get Python to use a custom library path

$
0
0
Would be useful to have a schema of this robot board (the webpages of this GoPiGo3 at first glance do not have a link like 'here is the schema'). Needed to know which GPIO pins are used and e.g. to see whether a second SPI is fully available.
Would also be useful to have a link to the robot source code, e.g. on github.
Same for the waveshare display you are using.
There is a Dexter Industries GoPiGo3 GitHub pages.
There is also a Waveshare Wiki that has all the relevant information.

There are two SPI ports but one is strictly reserved for the Raspberry Pi's own use.
SPI communication is intrinsic to the entire robot at a fundamental system level so whatever I do has to be absolutely global in nature, must exist at boot, (or whenever Python kicks in), and must persist across reboots.
These requirements are too strict. If you want to have the display code merged with the robot code, then the requirement is to have the SPI access snychronized within one program.
Actually not true. This is a normal and expected requirement for many projects I have been involved with in the past.

In fact, there's a solution of sorts:
1. I added my test library paths to the /etc/profile file. That solves the "global, survives a reboot" requirement.

2. A friend suggested a modification to the Waveshare files I will be working with:

Code:

import ossys.path.insert(1,"/home/pi/Test_Libraries/")# puts my lib before all dist package foldersimport EasyGoPiGo3 as easy
This forces the specific Waveshare files I will be working on within Thonny to respect that path.

However,
I still would like to find a way to force Thonny, (and Geany, mu, and the rest of the Python IDE's), to use my requested system path without having to modify every file I touch.

Thanks!

Statistics: Posted by jharris1993 — Tue Jul 02, 2024 10:24 am



Viewing all articles
Browse latest Browse all 3552

Trending Articles