Go to advanced search

by robbes
Thu Jan 20, 2022 6:38 pm
Forum: Python
Topic: Python wheels issue has been solved
Replies: 0
Views: 62

Python wheels issue has been solved

Those who have recently encountered an "Illegal instruction" while installing certain python packages will be relieved that this issue was resolved yesterday with a rebuilding of the wheels:
https://github.com/piwheels/packages/issues/269
by robbes
Thu Jan 13, 2022 6:49 pm
Forum: Python
Topic: Pandas, Plotly, Flask package issue
Replies: 2
Views: 122

Re: Pandas, Plotly, Flask package issue

This problem is occurring in a lot of packages. Here is a quote: bennuttall commented 6 days ago It looks like this issue is present in all cp39 wheels built in the last few weeks. Something must have changed in gcc or something which is producing armv6l-incompatible wheels. We're looking into it. F...
by robbes
Mon Jan 10, 2022 9:19 pm
Forum: Python
Topic: Getting "Illegal Instruction" on Debian Buster using Python3 modules
Replies: 3
Views: 153

Re: Getting "Illegal Instruction" on Debian Buster using Python3 modules

I had been using luma.oled successfully until a few days ago on this same Raspberry 2 running whatever Raspbian was current in 2018. I don't know if luma.oled has been updated since then. I should have been a bit more careful before deleting a working system, but I foolishly assumed that any problem...
by robbes
Mon Jan 10, 2022 6:46 pm
Forum: Python
Topic: Getting "Illegal Instruction" on Debian Buster using Python3 modules
Replies: 3
Views: 153

Re: Getting "Illegal Instruction" on Debian Buster using Python3 modules

I can't help you, but I am encountering this problem myself. In my case I have a new install of Raspberry OS on a Raspberry 2. I am trying to install the luma.oled package, and there are no indications of any problems. However, all the examples provided, as well as my own simple scripts, fail with t...
by robbes
Wed Nov 10, 2021 7:48 pm
Forum: Python
Topic: Problem: pyenv not working on buster (Rasp Pi 400 board)
Replies: 1
Views: 177

Re: Problem: pyenv not working on buster (Rasp Pi 400 board)

What is the output of

Code: Select all

pyenv versions
?

If you try to run python 3.9.7 as your system python, using

Code: Select all

pyenv global 3.9.7
is your system recognizing this?

What are the entries in your ~/.pyenv/versions folder.
by robbes
Wed Apr 14, 2021 4:12 pm
Forum: Python
Topic: Highest absolute Value in a Dictionary
Replies: 10
Views: 570

Re: Highest absolute Value in a Dictionary

If you don't need to know the key, you could do something like this:

Code: Select all

maxval = max([abs(x) for x in mydict.values()])
by robbes
Thu Jan 28, 2021 4:46 pm
Forum: Python
Topic: Control Android Phone with Python
Replies: 1
Views: 204

Re: Control Android Phone with Python

Take a look at the android-controller module:
https://pypi.org/project/android-controller/
by robbes
Tue Dec 29, 2020 3:26 am
Forum: Python
Topic: Labels on matplotlib
Replies: 6
Views: 395

Re: Labels on matplotlib

I took a look at some of the matplotlib docs and came to the conclusion that the methods I was proposing for label formatting were unnecessarily complicated. The following code works for me: import matplotlib.pyplot as plt import matplotlib.ticker as ticker date = ['12152300', '12152330', '12160000'...
by robbes
Sun Dec 27, 2020 8:17 pm
Forum: Python
Topic: Labels on matplotlib
Replies: 6
Views: 395

Re: Labels on matplotlib

I found that ticker.FixedLocator expects the location of the ticks (their index values), not the tick values. Something like this works for me: import matplotlib.pyplot as plt import matplotlib.ticker as ticker date = ['12152300', '12152330', '12160000', '12160030', '12160100', '12160130', '12160200...
by robbes
Sat Dec 26, 2020 7:36 pm
Forum: Python
Topic: Labels on matplotlib
Replies: 6
Views: 395

Re: Labels on matplotlib

Having over-consumed on 20201225, I can only suggest the following: First, look at the matplotlib ticker module https://matplotlib.org/3.3.3/api/ticker_api.html import matplotlib.ticker as ticker from matplotlib.ticker import FormatStrFormatter Replace your two xaxis formatting statements with primi...
by robbes
Mon Aug 24, 2020 4:45 pm
Forum: Python
Topic: How do I find out all the functions in an imported library
Replies: 5
Views: 268

Re: How do I find out all the functions in an imported library

There is a module called see which provides simple inspection of python objects. The output is more organized than that from the dir built-in function. Documentation is at https://pypi.org/project/see/ I have a line "from see import see" in my pythonstartup file so I always have this avail...
by robbes
Fri Aug 21, 2020 11:54 pm
Forum: Python
Topic: install uinput
Replies: 2
Views: 597

Re: install uinput

The uinput module is a python interface to the linux uinput kernel module. Are you sure the latter is installed?
Type the command

Code: Select all

lsmod
and check its output. If you don't see uinput in the list, run

Code: Select all

sudo modprobe uinput
by robbes
Thu Aug 20, 2020 4:56 pm
Forum: Python
Topic: how to change color of an input in python 3
Replies: 2
Views: 1081

Re: how to change color of an input in python 3

You should be using the python getpass module:
Many programs that interact with the user via the terminal need to ask the user for password values without showing what the user types on the screen. The getpass module provides a portable way to handle such password prompts securely.
by robbes
Wed Mar 20, 2019 4:41 pm
Forum: Python
Topic: How to use command terminal code in Python program?
Replies: 3
Views: 602

Re: How to use command terminal code in Python program?

The plumbum library might be convenient for your use case:
https://plumbum.readthedocs.io/en/latest/
by robbes
Mon Mar 04, 2019 5:39 pm
Forum: Python
Topic: Problem upgrading - broken Python installation
Replies: 3
Views: 644

Re: Problem upgrading - broken Python installation

You could try running

Code: Select all

dpkg --audit python
and

Code: Select all

dpkg --verify python
for suggestions, before doing --remove or --purge and reinstalling
by robbes
Wed Feb 20, 2019 7:18 pm
Forum: Python
Topic: Using python scripts in html / javascript
Replies: 4
Views: 787

Re: Using python scripts in html / javascript

How about a pure python webapp using PySimpleGUIWeb or remi ?
by robbes
Thu Jan 24, 2019 9:58 pm
Forum: Python
Topic: My Python is stuck
Replies: 6
Views: 1342

Re: My Python is stuck

I was not expecting the binary to be installed in that location (my ignorance!) but you don't have to "do" anything other than invoking python with $ /home/pi/Python-2.7.9/python Assuming pip was installed with this package, you would install flask-ask with /home/pi/Python-2.7.9/python -m ...
by robbes
Thu Jan 24, 2019 6:55 pm
Forum: Python
Topic: My Python is stuck
Replies: 6
Views: 1342

Re: My Python is stuck

As you have already recognized, the issue has nothing to do with your hardware. On your production machine, if you enter

Code: Select all

$ python --version
then I imagine you will see python 2.7.3.
Can you not just use

Code: Select all

$ python2.7.9
and

Code: Select all

$ python2.7.9 - m pip
instead?
by robbes
Wed Dec 12, 2018 2:24 am
Forum: Python
Topic: Upgrade Python from 3.5.3 to latest version
Replies: 15
Views: 74918

Re: Upgrade Python from 3.5.3 to latest version

On my not-quite-updated Raspberry Pi, installed python3.5 packages are at /usr/lib/python3.5/dist-packages/ if installed by apt, and at /usr/local/lib/python3.5/dist-packages/ if installed by pip. If you run >>> import site >>> site.getsitepackages() then you should get a list of all the package ins...
by robbes
Tue Dec 11, 2018 9:18 pm
Forum: Python
Topic: Upgrade Python from 3.5.3 to latest version
Replies: 15
Views: 74918

Re: Upgrade Python from 3.5.3 to latest version

I don't think your code

Code: Select all

(venv) pi@raspberrypi:~/projects/venv $ sudo apt-get install python3-smbus
is acting as you want.
You can run apt-get from anywhere (including from a python virtual environment) and it will still perform a global install.
Have you tried the system-site-packages flag?
by robbes
Tue Dec 11, 2018 6:28 pm
Forum: Python
Topic: Upgrade Python from 3.5.3 to latest version
Replies: 15
Views: 74918

Re: Upgrade Python from 3.5.3 to latest version

and when I try to import smbus I get a module not found error It seems you have installed python3-smbus globally and do not have access to it inside your virtual environment. Try setting up your environment using the system-site-packages flag: python3 -m venv <your_env_name> --system-site-packages
by robbes
Mon Oct 22, 2018 4:54 pm
Forum: General discussion
Topic: How build an app run some web server, web app?
Replies: 1
Views: 488

Re: How build an app run some web server, web app?

systemd should do that. Google "systemd user services".
by robbes
Tue Sep 11, 2018 3:57 pm
Forum: Python
Topic: importing modules from other directory paths
Replies: 9
Views: 2629

Re: importing modules from other directory paths

What is in your variable PYTHONPATH?
Have you made PYTHONPATH available to the python interpreter through an export statement? sys.path won't be able to access it otherwise.

Go to advanced search