Hi Gary,
Yo Ken!
On Wed, 3 Jul 2019 08:14:43 -0600
Ken McGuire <address@hidden> wrote:
> > >/> Missing $PYTHONPATH!/
> >
> > No comment? Serious problem.
>
> Well, I'm probably not qualified to comment on that, first time I've
> run into $PYTHONPATH.
Because you have not installed a lot of packages from source.
Certainly true.
> I run many different linux distros:
> x86:
Sort of, they are all Ubuntu derived, thus very similar.
> Arm:
And those are all Debian derived, thus very similar.
> All of them install Python2 and Python3 by default, and none set
> $PYTHONPATH.
Yes, $PYTHONPATH is for customer installed softare that is not
from upstream packages. Which, if you compile our sources, is the
present case.
Ok... so when some code it built & installed from source, you
may or may not need to set $PYTHONPATH, depending on what other
modules your installed code needs. Or whether your code is used by
other code as a module.
> I'm not a
> programmer so for something like $PYTHONPATH to escape my knowledge
> is very likely, especially if what I'm doing in Python works without
> it being set.
$PYTHONPATH is not for programmers, it is for users that install
3rd party source.
Still learning....
Think of $PYTHONPATH just like $PATH, except $PYTHONPATH is for
Python modules and $PATH is for scripts and executables.
To see your default built-in $PYTHONPATH:
# python
Python 2.7.16 (default, Jul 1 2019, 17:28:45)
[GCC 9.1.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/local/lib64/python2.7/site-packages', '/usr/lib64/python27.zip',
'/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gtk-2.0']
Any module in each of those directories can be directly imported.
Modules installed elsewhere will not be found.
python
Python 2.7.6 (default, Nov 13 2018, 12:45:42)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import sys
>>> print(sys.path)
['',
'/usr/local/lib/python2.7/dist-packages/uncompyle6-2.9.10-py2.7.egg',
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
>>>
So when I run "scons install" it will create/add to my default
path, or is that an exercise left to the user?
> I developed an application that is based on cgps but drives a 240x240
> tft display with location, sig strength and skyview. I did a version
> for the desktop too using SDL2, if you have any interest is having
> this code for an example for gpsd I'd be glad to contribute it.
Yes, but it would need a bit of work to get done. Like removing your
hard coded paths, ensuring Python 2/3 compatibility, documentation,
etc.
Anything I write/wrote will no doubt need some work ;>)) it is
written in C, just like cgps...
> Attached is a screenshot of what it looks like. (the 2 images were
> taken at different times and are not intended to show the same data)
Nice. gpsd can use some sample graphical clients.
Not everyone wants/needs to use X or ncurses (or even SDL).
...ken...
RGDS
GARY
|