Python Forum
Illegal instruction? working code for months?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Illegal instruction? working code for months?
Hello ,
strange issue
I have a PI3 working with a python code that show data on I2C Oled display.
this code and PI works great for the last 6 months~
today I saw it's stop working (showing data - I reboot the the pi
and the app didn't boot

when I try to run the code manually , I got this error:
[email protected]:~ $ python3 /home/pi/
Illegal instruction
even when I change the code and put syntax errors - I still got this error

what is wrong? and mpre importent what happand?

*** no one it using this pi , I didn't run update\upgrade for 6 months now
"illegal instruction" means the pi is trying to run code that isn't correct for that machine. This isn't a problem with your python script, it's a problem with the actual python executable or one of the modules imported by your script. You might be able to tell just by seeing if python3 runs on its own. Does python3 -c "print('ok')" work or get the same error? If that works, you might be able to find what module is causing the problem.

Unfortunately if python3 is broken, sorting that out is going to be something on the Pi side. Could be you need to update some packages, could be it would be better to restart from scratch. We can't tell what happened. Maybe something updated some packages from the wrong repo. Maybe the SD card filesystem became corrupted from a powerdown. Might need to ask in a Pi forum.
when I run the command
it's working
[email protected]:~ $ python3 -c "print('ok')"
so now try to check all the imports I have in the code ? to see which one casue the problem ?
then reinstall it ?
Looks like a C-Extension is crashing. What does import?
Almost dead, but too lazy to die:
All humans together. We don't need politicians!
this is very strange......

I have created a file with all the import:
import time
from datetime import datetime
import Adafruit_SSD1306
import subprocess
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

import os
import sys
import random
from random import randint

import RPi.GPIO as GPIO 
run it , didn't get any error

then I try to run my working full code
and it works ....

how could it be ?
I didn't change anything \ didn't reboot the pi since yesterday \ didn't run update&&upgrade

Possibly Related Threads…
Thread Author Replies Views Last Post
  My Code isn't working... End3r 4 759 Mar-21-2022, 10:12 AM
Last Post: End3r
  I don't undestand why my code isn't working. RuyCab 2 1,293 Jun-17-2021, 03:06 PM
Last Post: RuyCab
  How to convert dates in odd format to months lokhtar 2 1,442 Apr-17-2021, 11:54 AM
Last Post: lokhtar
  code is not working , can anybody help? RandomPerson69 4 1,743 Mar-22-2021, 04:24 PM
Last Post: deanhystad
  Short code for EventGhost not working Patricia 8 2,221 Feb-09-2021, 07:49 PM
Last Post: Patricia
  Code no longer working yk303 14 5,773 Dec-21-2020, 10:58 PM
Last Post: bowlofred
  How to calculate a months' 1st, 4th, 7th day and also 1st again? cananb 3 1,439 Nov-12-2020, 08:23 AM
Last Post: perfringo
  autocomplete working code sample not working... aviper4u 0 1,170 Oct-24-2020, 03:04 AM
Last Post: aviper4u
  How to groupby Months showing average order value - Pandas & matplotlib Rwood90 0 1,209 Oct-20-2020, 12:53 PM
Last Post: Rwood90
  code not working, NameError: name 's' is not defined ridgerunnersjw 4 2,239 Oct-05-2020, 07:03 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020