ryguystye
Posts: 4
Joined: Tue Nov 19, 2013 7:58 am

RPIO error

Tue Nov 19, 2013 8:09 am

http://pythonhosted.org/RPIO/index.html

Hi. I just got my Pi and am fairly nub with linux. I'm trying to use RPIO and have gotten it installed and updated, but I get an error trying to use the "rpio-curses" command. The other command line commands seem to work, but I'd like to use the graphical interface feature. What does this mean?

Code: Select all

[email protected] ~ $ rpio-curses
Script not started as root. Running sudo...
Traceback (most recent call last):
  File "/usr/local/bin/rpio-curses", line 5, in <module>
    pkg_resources.run_script('RPIO==0.10.0', 'rpio-curses')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/RPIO-0.10.0-py2.7-linux-armv6l.egg/EGG-INFO/scripts/rpio-curses", line 495, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/RPIO-0.10.0-py2.7-linux-armv6l.egg/EGG-INFO/scripts/rpio-curses", line 461, in main
    d.start()
  File "/usr/local/lib/python2.7/dist-packages/RPIO-0.10.0-py2.7-linux-armv6l.egg/EGG-INFO/scripts/rpio-curses", line 417, in start
    self.draw()
  File "/usr/local/lib/python2.7/dist-packages/RPIO-0.10.0-py2.7-linux-armv6l.egg/EGG-INFO/scripts/rpio-curses", line 182, in draw
    screen.addstr(pos_y, POS_GPIOLIST_X, option)
_curses.error: addstr() returned ERR

User avatar
metachris
Posts: 96
Joined: Wed Feb 06, 2013 1:52 pm
Location: Vienna, Austria

Re: RPIO error

Tue Nov 19, 2013 3:36 pm

Hello!

Thanks for posting. Can you try making the console window larger? Perhaps this could help.

Cheers,
Chris
pythonhosted.org/RPIO

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: RPIO error

Tue Nov 19, 2013 6:36 pm

In case it helps...

I've just tried rpi-curses from a remote ssh session initiated from PuTTy running on a WInXP machine, using whatever the default terminal size setting is. { checked: 24r x 80c }

I get exactly the same error report as @ryguystye.

If I click the Windows 'maximise' button to make the PuTTy session run Full Screen and repeat the rpi-curses command, it runs correctly.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
DougieLawson
Posts: 35805
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPIO error

Tue Nov 19, 2013 9:15 pm

DeeJay wrote: I've just tried rpi-curses from a remote ssh session initiated from PuTTy running on a WInXP machine, using whatever the default terminal size setting is. { checked: 24r x 80c }
It would be useful if the author told us what screen dimensions he/she expects us to use. I'd have made sure that it at least generated a sensible error message when used on 24*80.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: RPIO error

Tue Nov 19, 2013 9:31 pm

DougieLawson wrote:It would be useful if the author told us what screen dimensions he/she expects us to use. I'd have made sure that it at least generated a sensible error message when used on 24*80.
I think the other contributor to this thread might be the author, which was why I fed back the default screen dimensions that caused me a problem...
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

ryguystye
Posts: 4
Joined: Tue Nov 19, 2013 7:58 am

Re: RPIO error

Tue Nov 19, 2013 11:34 pm

Thanks, problem solved. I was using LX terminal in the desktop. Making the window bigger worked

User avatar
DougieLawson
Posts: 35805
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPIO error

Tue Nov 19, 2013 11:44 pm

ryguystye wrote:Thanks, problem solved. I was using LX terminal in the desktop. Making the window bigger worked
That's only a bypass. It's not useful if you have to remember to do that for the sake of a layout change in the code. If I knew anything about python-curses I'd write a patch for it. (That may be a project for next weekend.)
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: RPIO error

Wed Nov 20, 2013 10:06 am

A literal value of '27' is used in both draw_cursor and move_cursor, so a screen of at least 27 (28?) rows deep must be being assumed.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
DougieLawson
Posts: 35805
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPIO error

Wed Nov 20, 2013 4:28 pm

DeeJay wrote:A literal value of '27' is used in both draw_cursor and move_cursor, so a screen of at least 27 (28?) rows deep must be being assumed.
That worked. I stretched the screen by three lines (kept it 80 wide) and cured the problem. Now to hack the layout.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DougieLawson
Posts: 35805
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPIO error

Wed Nov 20, 2013 5:11 pm

here's my ugly.hack.diff to make it fit 24 deep

Code: Select all

--- rpio-curses 2013-11-20 17:08:42.108109068 +0000
+++ rpio-curses~        2013-11-20 16:50:39.854435714 +0000
@@ -148,7 +148,7 @@
     pos_cursor_y = None  # gets set from __init__ to allow adjustments
     pos_cursor_x = POS_GPIOLIST_X - 3

-    pos_cursor_menu2_y = POS_GPIOINFO_Y + 1
+    pos_cursor_menu2_y = POS_GPIOINFO_Y + 5
     pos_cursor_menu2_x = POS_GPIOINFO_X - 1

     thread = None
@@ -178,15 +178,15 @@
             pos_y += 1

         for option in OPTIONS:
-            screen.addstr(pos_y, POS_GPIOLIST_X, option)
             pos_y += 1
+            screen.addstr(pos_y, POS_GPIOLIST_X, option)

         # Cursor
         self.draw_cursor()

     def draw_cursor(self):
         self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x, ">")
-        self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x+23, "<")
+        self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x+27, "<")

     def draw_gpio_info(self, gpio_index):
         gpio, function, state = self.gpios[gpio_index]
@@ -276,7 +276,7 @@
             py = 0

         self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x, " ")
-        self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x+23, " ")
+        self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x+27, " ")

         self.cursor_index = py
         self.pos_cursor_y = self.cursor_index + POS_GPIOLIST_Y
@@ -366,7 +366,7 @@

         # remove old cursor
         self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x, " ")
-        self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x+23, " ")
+        self.screen.addstr(self.pos_cursor_y, self.pos_cursor_x+27, " ")

         # enter menu2
         self.is_menu2 = True
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: RPIO error

Wed Nov 20, 2013 5:38 pm

Just to confirm that patch works for me here with a default invocation of a PuTTy ssh session.

Thanks.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Return to “Troubleshooting”