element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum pifce cad 2 ir problems
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 10 replies
  • Subscribers 707 subscribers
  • Views 1611 views
  • Users 0 members are here
  • raspberry_pi
  • ir problem
Related

pifce cad 2 ir problems

jeffstalzer
jeffstalzer over 9 years ago

I have a PiFace CAD 2 on a Pi3 and the ir examples do not work. irw works and it is recognizing cmds from the ir remote. But the radio.py example fails w/ trace back:

Playing 6 Music.

Traceback (most recent call last):

  File "/home/pi/Desktop/radio.py", line 221, in <module>

    lircrc="/usr/share/doc/python3-pifacecad/examples/radiolircrc")

  File "/usr/lib/python3/dist-packages/pifacecad/ir.py", line 39, in __init__

    self.event_queue = multiprocessing.queues.SimpleQueue()

TypeError: __init__() missing 1 required keyword-only argument: 'ctx'

 

other examplse give the same "missing 1 required keyword-only"

  • Sign in to reply
  • Cancel
  • fvan
    0 fvan over 9 years ago

    Could you tell us how you are running the scripts, which command exactly?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gecoz
    0 gecoz over 9 years ago

    I'm guessing you are using Python 3.x. With Python 2.x, initialising SimpleQueue() without passing a context works, but Python 3.x requires a context defined (ctx)

     

    Python 2.7.13 (default, Jan 19 2017, 14:48:08)

    [GCC 6.3.0 20170118] on linux2

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import multiprocessing.queues

    >>> q=multiprocessing.queues.SimpleQueue()

    >>>

    --------------------------------------------------------------

    Python 3.5.3+ (default, Jun  7 2017, 23:23:48)

    [GCC 6.3.0 20170516] on linux

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import multiprocessing.queues

    >>> q=multiprocessing.queues.SimpleQueue()

    Traceback (most recent call last):

      File "<stdin>", line 1, in <module>

    TypeError: __init__() missing 1 required keyword-only argument: 'ctx'

     

    Hope this helps.

    Fabio.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gecoz
    0 gecoz over 9 years ago

    Forgot to add that for Python 3.x you should instantiate a SimpleQueue from the multiprocessing module, rather than directly from multiprocessing.queues. Try replacing:

     

    self.event_queue = multiprocessing.queues.SimpleQueue()

     

    with:

     

    self.event_queue = multiprocessing.SimpleQueue()

     

    (make sure you import multiprocessing)

     

    Fabio.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jeffstalzer
    0 jeffstalzer over 9 years ago in reply to fvan

    I am running Python 3 and using it to open radio.py. If I do that w/ python 2 I get an error msg "Radio only works with 'python3'""

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jeffstalzer
    0 jeffstalzer over 9 years ago in reply to fvan

    I am running Python 3 and using it to open radio.py. If I do that w/ python 2 I get an error msg "Radio only works with 'python3'""

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • fvan
    0 fvan over 9 years ago in reply to jeffstalzer

    gecoz last suggestion may do the trick then. Give it a try and let us know! image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jeffstalzer
    0 jeffstalzer over 9 years ago in reply to gecoz

    no luck so far--still does not work'

    I'm missing something simple.
    This simple code should work (it is an example from the PiFace documentation):

    #piface cad ir test

     

     

    #cat ~/.lircrc

    #begin

    #  prog = pifacecadexample

    #  button = KEY_VOLUMEUP

    #  config = one

    #end

     

     

    #begin

    #  prog = pifacecadexample

    #  button = KEY_VOLUMEDOWN

    #  config = two

    #end

     

     

     

     

    import pifacecad

    import time

    import multiprocessing.queues

     

     

    def print_ir_code(event):

        print(event.ir_code)

     

     

    q=multiprocessing.queues.SimpleQueue()

       

    pifacecad.PiFaceCAD()  # initialise a PiFace Control and Display board

    listener = pifacecad.IREventListener(prog="pifacecadexample")

    listener.register('one', print_ir_code)

    listener.register('two', print_ir_code)

    listener.activate()

     

     

    time.sleep(20.0)

    print("Stopping...")

    listener.deactivate()

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gecoz
    0 gecoz over 9 years ago in reply to jeffstalzer

    Try with this version, where I replaced the import and the the way SimpleQueue is istantiated:

     

    import pifacecad
    import time
    import multiprocessing
    
    
    def print_ir_code(event):
        print(event.ir_code)
    
    
    q=multiprocessing.SimpleQueue()
        
    pifacecad.PiFaceCAD()  # initialise a PiFace Control and Display board
    listener = pifacecad.IREventListener(prog="pifacecadexample")
    listener.register('one', print_ir_code)
    listener.register('two', print_ir_code)
    listener.activate()
    
    
    time.sleep(20.0)
    print("Stopping...")
    listener.deactivate()

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jeffstalzer
    0 jeffstalzer over 9 years ago in reply to gecoz

    No. That did not work. Got this failure under Python 2:

    Traceback (most recent call last):

      File "/home/pi/PiFace_stuff/piface_tst_ir_blog0.py", line 12, in <module>

        q=multiprocessing.SimpleQueue()

    AttributeError: 'module' object has no attribute 'SimpleQueue'

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gecoz
    0 gecoz over 9 years ago in reply to jeffstalzer

    Yes, it won't work with python 2. I wrote that thinking that you were using python 3. Just so we are on the same page, could I ask you which version are you going to use, python 2 or python 3? I believe you can use either, as stated on the PiFace CAD documentation. The choice is your, just let me know, then we can try and figure out what errors you get and why.

    Fabio.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube