3

i wrote a script like this for GPIO pins in raspberrypi

from gpiozero import LED
led = LED(12)

and Runs correctly. but when create executable file using pyinstaller, and execute file. i have this error:

/tmp/_MEIFanWCr/gpiozero/devices.py:279: PinFactoryFallback: Falling back from rpigpio: No module named 'gpiozero.pins.rpigpio'
/tmp/_MEIFanWCr/gpiozero/devices.py:279: PinFactoryFallback: Falling back from rpio: No module named 'gpiozero.pins.rpio'
/tmp/_MEIFanWCr/gpiozero/devices.py:279: PinFactoryFallback: Falling back from pigpio: No module named 'gpiozero.pins.pigpio'
/tmp/_MEIFanWCr/gpiozero/devices.py:279: PinFactoryFallback: Falling back from native: No module named 'gpiozero.pins.native'
Traceback (most recent call last):
  File "mytk.py", line 8, in <module>
  File "gpiozero/devices.py", line 124, in __call__
  File "gpiozero/output_devices.py", line 211, in __init__
  File "gpiozero/output_devices.py", line 93, in __init__
  File "gpiozero/mixins.py", line 106, in __init__
  File "gpiozero/devices.py", line 512, in __init__
  File "gpiozero/devices.py", line 243, in __init__
  File "gpiozero/devices.py", line 280, in _default_pin_factory
gpiozero.exc.BadPinFactory: Unable to load any default pin factory!
[1597] Failed to execute script 

how i can create executable file that contains gpiozero?

1 Answer 1

4

We have to write like this:

from gpiozero.pins.native import NativeFactory
from gpiozero import LED

factory = NativeFactory()
led = LED(12, pin_factory=factory)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.