Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
7

If you look in /usr/bin, there are actually only two versions installed: $ ls -la /usr/bin/python* lrwxrwxrwx 1 root root 9 Jun 5 23:08 /usr/bin/python -> python2.7 -rwxr-xr-x 1 root root 2679344 May 6 19:31 /usr/bin/python2.7 lrwxrwxrwx 1 root root 9 Aug 2 18:04 /usr/bin/python3 -> python3.2 lrwxrwxrwx 1 root root 11 Jul 6 09:52 /...


7

The command is: cat /proc/cpuinfo And the list over the different hardware is here: http://elinux.org/RPi_HardwareHistory#Board_Revision_History Table over hardware differences: https://www.element14.com/community/community/raspberry-pi/blog/2016/11/21/how-to-identify-which-model-of-the-raspberry-pi-you-have


6

There is NO NEED to do anything before a reboot. If you issue a sudo reboot command Linux will manage an orderly shutdown of the software. This is, however, a poor way of ensuring a reliable 24/7 system. If it crashes there is no guarantee the reboot itself would happen. The normal solution would be to use a watchdog timer. The Pi has an inbuilt hardware ...


6

Thats because by using 'GPIO.setmode(GPIO.BCM)' you are specifying the BCM numbering convention. GPIO 18 is actual pin number 12.


5

Neither thread is actually started. Instead of threading.Thread(target = thread1()) you should use threading.Thread(target = thread1) At the moment you are calling a function which never returns so subsequent lines of the script are not executed.


5

As is typical with crontab issues. The environment is not the same as your user or even a sudo/root shell , and env python3 may not return anything (env simply searches through Instead you should explicitly use the full path of python which can be found either as which python3 or which $(env python3) and use that full path in your crontab (typically /usr/...


4

According to docs.python.org os.popen() is stacked on top of subprocess.Popen() - at least for Python 3.x: This is implemented using subprocess.Popen; see that class’s documentation for more powerful ways to manage and communicate with subprocesses. So other than losing some of the more finegrained controls the underlying subprocess.Popen() provides ...


4

The code you use has the standard errors for this algorithm. It assumes everything always works perfectly without error. As a programming exercise you need to think about under what conditions the while loops would not terminate. You then need to protect against those conditions. The code you linked has added protection in one loop but not the other. It ...


4

You have to install the MySQLdb package: sudo apt-get update then sudo apt-get install python3-dev libmysqlclient-dev This took a while and finally: sudo pip3 install mysqlclient now it should work the following command: pi@raspberrypi:~ $ python3.5 Python 3.5.2 (default, Dec 15 2017, 15:32:37) [GCC 4.9.2] on linux Type "help", "copyright", "credits" ...


4

python is never Python 3 in Debian, even if you have installed Python 3. Python 3 will install as python3, and the python binary points to Python 2 (see PEP 394) instead. In Python 2, the socketserver module used to be called SocketServer (note the caps). Changing all references from socketserver to SocketServer would address that. You can solve this by ...


4

Building scipy from source takes about 1hr20. Pre-compiled wheels are available from piwheels.org, so you can install it from there without building yourself. Raspbian Stretch is pre-configured to use piwheels. Are you on an older Raspbian version or another distribution? See piwheels.org for info on how to configure your system to use it or try: sudo pip3 ...


4

Your script is a typical use of a service. Usually a service is started once and then it is running in background until it is stopped by the service manager. The service manager can restart a script but it isn't made to be used for loops because it is working on system level with logging and dependency checking and all to manage services. So first you ...


3

You have not told us which system you use so it is speculation as to whether you will have problems or not. I believe Debian based systems use Python 2 for system purposes.


3

I'm seeing mixed messages about running PyCharm directly on the Raspberry Pi, but there's an existing thread on StackOverflow that seems to mention you can run it there (see below). One thing is certain: Jetbrains does provide a way of doing remote development between a PyCharm installation on a Laptop/Desktop and a remote Pi, but that's not what you seem ...


3

You could try to use matplotlib without QT, i.e. with a non-interactive backend, if non-interactive plotting generating image files only is the goal. It will skip any overhead related to the GUI backends. From matplotlib's FAQ: There are two types of backends: user interface backends (for use in pygtk, wxpython, tkinter, qt4, or macosx; also referred to ...


3

Python 3 is a backward incompatible upgrade of the language. As already mentioned, so much was changed, that most programs won't work on Python 3 without modifications. Even worse, many Python libraries are not compatible with Python 3 yet. This is why at least two versions are needed - legacy Python 2.x and new Python 3.x. This is exactly what you have on ...


3

From the error log, it seems to be an issue with the SSL protocol being used: File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1149, in _raise_ssl_error raise WantReadError() OpenSSL.SSL.WantReadError This seems to be related to the recent blackout in supporting TLS 1.0 and 1.1 for pip. See this answer for details. In summary, upgrade pip as ...


3

WIFI Configuration Before Complete Boot-up Of Pi You cannot usefully do anything network related before the Pi boots up properly. I think you have just misconstrued the concept of "booting", and what you really mean is you want the Pi to boot up the first time in a state where the goal is to get a wifi configuration somehow. Kind of like when you buy an ...


3

No, it is not necessary to stop the Pi camera before rebooting.


3

No there is no need to stop the camera before reboot. Also preforming killall python is not doing you any good as the reboot is going to force the program to close anyway. If you are worried about your program needing to shutdown gracefully, you should notify the program to shutdown rather then kill it. A simple way would be to use touch in your crontab ...


3

This error was resolved when I disconnected and reconnected my camera module. Somehow my camera module must have been wiggled loose when I was working with it and the Pi was not able to detect the camera. I ran the command: vcgencmd get_camera and got Returned supported=1 detected=0 Once the camera was reconnected, I was able to run raspistill -o image....


3

In Python 3 print is a function. In Python 2 you could do print "hello". In Python 3 you must do print("hello").


3

Python installations generally do not share modules between them. Modules installed for Python 2 will not be shared with the Python 3 installation (they are stored in different locations, etc). At least for now, python and pip refer to the Python 2 versions of the toolchain. As such, most Python tools have a Python 3 equivalent. If you used sudo pip ...


3

If you read the documentation, there are two mistakes in your code. First, just use import l293d. Second, use motor1 = l293d.DC(22, 18, 16) There isn't a motor attribute, but there is a DC attribute for DC motors. This runs on my system. jay@gotham:~/python$ python3 test.py [l293d]: Can't import RPi.GPIO; test mode has been enabled: http://l293d.rtfd.io/...


3

There are some benchmarks from Henner Zeller's repository on GitHub which claimed that directly outputting data to the GPIO could achieve up to 65.8 MHz on a Raspberry Pi 3 (not B+, mind, but I suspect the figures won't be that far off). The code used is available here in C and the author gives the following pseudocode equivalent: // Pseudocode for (;;) { ...


3

Add a function to read_cpu_temp then call that function to display instead of read_sensor: from guizero import * import random def read_sensor(): return random.randrange(3200, 5310, 10) / 100 def read_cpu_temp(): tFile = open('/sys/class/thermal/thermal_zone0/temp') temp = float(tFile.read()) return temp/1000 def update_label(): ...


3

wpa_supplicant will not be running in the container unless you start it. A major difference between docker containers and a normal environment is that there are no system services running in the container unless you run it with init or systemd as the base command, since it is init (systemd is an init implementation) that manages these. Containers are ...


3

You can help yourself by collecting any error messages that are generated when cron runs your scripts. As you're aware, your shell will send error messages to the stderr stream when they occur. When you run the program from your terminal screen, this stderr stream goes to your terminal, and you see it. However, your cron job does NOT run under your userid, ...


3

The code is written in Python which is an interpreted language. It will be somewhat slower than a compiled language such as C. You have many print statements in the code. That will slow the main loop considerably.


3

We don't know anything about your robot's size or shape, and that could matter. Some shapes are easier to balance, for example, and therefore probably less sensitive to control timing delays. Balance is often time-sensitive, however, so I'm working under that assumption for what follows. You have several potential issues here. Depending on your situation,...


Only top voted, non community-wiki answers of a minimum length are eligible