You are not logged in.

#1 2013-01-24 21:45:13

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 107

[SOLVED] ARandR problem

Hi,

ARandR does not start from Openbox menu. If I want to execute this from the terminal I get this message:

Traceback (most recent call last):
  File "/usr/bin/arandr", line 42, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 318, in main
    force_version=options.force_version
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 159, in __init__
    self.filetemplate = self.widget.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/widget.py", line 93, in load_from_x
    self._xrandr.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/xrandr.py", line 150, in load_from_x
    o.modes.append(Size(int(a) for a in d.strip().split(" ")[0].split("x")))
  File "/usr/lib/python2.7/site-packages/screenlayout/auxiliary.py", line 53, in __new__
    arg = tuple(arg)
  File "/usr/lib/python2.7/site-packages/screenlayout/xrandr.py", line 150, in <genexpr>
    o.modes.append(Size(int(a) for a in d.strip().split(" ")[0].split("x")))
ValueError: invalid literal for int() with base 10: '1080i'

I used this program on my laptop (connected to a TV) before but I have no idea where it went wrong. It is true I have just reinstalled Arch but in the same way as before. Can anyone help?

Last edited by totolotto (2013-01-27 07:12:53)

Offline

#2 2013-01-24 22:01:22

Whoracle
Member
Registered: 2010-11-02
Posts: 12

Re: [SOLVED] ARandR problem

I'm almost completely sure that's an error in the program. wait for a fix/report it upstream or try fixing it yourself if you know python.

it tries to do something with an integer, but gets a string instead.

Offline

#3 2013-01-26 09:41:48

guy
Member
Registered: 2012-08-25
Posts: 4

Re: [SOLVED] ARandR problem

Hi

I had the same issue with one of my flatscreen. In order to solve it, I patched line 150 of /usr/lib/python2.7/site-packages/screenlayout/xrandr.py from

o.modes.append(Size(int(a) for a in d.strip().split(" ")[0].split("x")))

to

o.modes.append(Size(int(a.replace("i", "")) for a in d.strip().split(" ")[0].split("x")))

It's not the most elegant way to solve it because arandr will display two times the same mode but at least it will select the correct resolution.

Last edited by guy (2013-01-26 09:42:09)

Offline

#4 2013-01-26 15:07:39

ackt1c
Member
From: Visalia, California
Registered: 2012-10-10
Posts: 215

Re: [SOLVED] ARandR problem

Have you tried xrandr?

Offline

#5 2013-01-27 07:07:52

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 107

Re: [SOLVED] ARandR problem

Yes this forced me to find a solution with xrandr and actually I have found a much better one. I used arandr to turn off my laptop screen when it is connected to a TV.  In this forum I have found a script for dual monitor setup and after small modifications:

LVDS="LVDS1"
HDMI="HDMI3"

CHK_HDMI=$(xrandr |grep $HDMI | awk ' { print $2 } ')
CHK_HDMI_G=$(xrandr |grep $HDMI | grep "+")

function lvds_off(){
xrandr --output $LVDS --off --output $HDMI --auto
}

if [ "$CHK_HDMI" == "connected" ]; then
    lvds_off
else
    xrandr --output $LVDS --auto
fi

It does exaclty what I need, it automatically manages the laptop monitor. Perfect solution, I am very happy that arandr broke:)

Offline

#6 2013-01-27 07:14:29

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 107

Re: [SOLVED] ARandR problem

guy wrote:

Hi

I had the same issue with one of my flatscreen. In order to solve it, I patched line 150 of /usr/lib/python2.7/site-packages/screenlayout/xrandr.py from

o.modes.append(Size(int(a) for a in d.strip().split(" ")[0].split("x")))

to

o.modes.append(Size(int(a.replace("i", "")) for a in d.strip().split(" ")[0].split("x")))

It's not the most elegant way to solve it because arandr will display two times the same mode but at least it will select the correct resolution.

Thanks for this but as I posted I solved it in differently. Either way I marked this post as solved.

Offline

#7 2013-02-06 19:47:19

chancho
Member
From: Hong Kong
Registered: 2006-07-14
Posts: 112

Re: [SOLVED] ARandR problem

thanks, patch the file does solve the problem,

Offline

#8 2013-02-13 19:05:47

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: [SOLVED] ARandR problem

Now with xrandr updated from 1.3.5 to 1.4.0 the fix doesn't work anymore and arandr is broken again.

Output:

% arandr
Traceback (most recent call last):
  File "/usr/bin/arandr", line 42, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 318, in main
    force_version=options.force_version
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 159, in __init__
    self.filetemplate = self.widget.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/widget.py", line 93, in load_from_x
    self._xrandr.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/xrandr.py", line 135, in load_from_x
    geometry = Geometry(hsplit[2])
  File "/usr/lib/python2.7/site-packages/screenlayout/auxiliary.py", line 81, in __new__
    width,rest = width.split("x")
ValueError: need more than 1 value to unpack

Offline

#9 2013-02-13 20:23:14

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] ARandR problem

I had this problem before arandr was updated to 0.1.6-2 too. I updated to xrandr 1.4.0 and I still don't have any problems.
Please paste the full output of xrandr.

BTW, this same bug has already been reported upstream (https://gitorious.org/arandr/arandr/merge_requests/1) and the fix there is:

for d in details:
+    if d.strip().split(" ")[0].endswith('i'):
+        continue
    o.modes.append(Size(int(a) for a in d.strip().split(" ")[0].split("x")))

This means you won't have duplicate resolutions. However it's not been merged into master branch so who knows if will be approved as is.

Offline

#10 2013-02-19 11:19:00

Micah89
Member
Registered: 2011-05-01
Posts: 29

Re: [SOLVED] ARandR problem

I've found the same problem than Army:

Army wrote:

Now with xrandr updated from 1.3.5 to 1.4.0 the fix doesn't work anymore and arandr is broken again.

Output:

% arandr
Traceback (most recent call last):
  File "/usr/bin/arandr", line 42, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 318, in main
    force_version=options.force_version
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 159, in __init__
    self.filetemplate = self.widget.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/widget.py", line 93, in load_from_x
    self._xrandr.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/xrandr.py", line 135, in load_from_x
    geometry = Geometry(hsplit[2])
  File "/usr/lib/python2.7/site-packages/screenlayout/auxiliary.py", line 81, in __new__
    width,rest = width.split("x")
ValueError: need more than 1 value to unpack

Is this an arch only problem or should this be reported upstream? I can't find any report of this error on arand website or gitorious where the project is hosted. (or is this related with xrandr update?)

Thank you!

Last edited by Micah89 (2013-02-19 11:21:12)

Offline

#11 2013-02-19 12:26:22

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] ARandR problem

It's an upstream problem. Upstream though hasn't had any activity for a while. Same as I asked of Army; Please paste the full output of xrandr.

Offline

#12 2013-02-19 12:32:35

Micah89
Member
Registered: 2011-05-01
Posts: 29

Re: [SOLVED] ARandR problem

I don't have any xrandr output and i never used xrandr (directly), i've always used arandr and i get that error when trying to run arandr. It doesn't even show the GUI.
(i can follow instructions though =P)

Last edited by Micah89 (2013-02-19 12:33:32)

Offline

#13 2013-02-19 12:34:44

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] ARandR problem

arandr depends on xorg-xrandr which provides you with the command xrandr. arandr executes xrandr and parses the output, hence I would like to know your xrandr output.

Edit: You have no xrandr output at all? Oh. In that case this is not an upstream arandr problem. I have no idea why xrandr doesn't give you any output, but that's what's causing this problem for you.

Last edited by SidK (2013-02-19 12:51:47)

Offline

#14 2013-02-19 13:48:56

Micah89
Member
Registered: 2011-05-01
Posts: 29

Re: [SOLVED] ARandR problem

What i meant is that i don't know the command that arandr issues to run manually and give you a complete output of xrandr error. Nor do i know how to extract that info.
Although it will be hard since the error occurs at startup (not at "apply" time).

Offline

#15 2013-02-19 14:07:23

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] ARandR problem

It runs xrandr with no parameters. Sorry, I should have made this clearer from the start.
Please do:

$ xrandr

Paste the results here.

Offline

#16 2013-02-19 14:09:46

Micah89
Member
Registered: 2011-05-01
Posts: 29

Re: [SOLVED] ARandR problem

Well this is the result:

% xrandr 
Screen 0: minimum 8 x 8, current 2646 x 1024, maximum 8192 x 8192
VGA-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
   1280x1024      60.0*+   75.0  
   1280x960       60.0  
   1152x864       75.0     70.0  
   1024x768       75.0     70.1     60.0  
   800x600        75.0     72.2     60.3     56.2  
   640x480        75.0     72.8     59.9  
LVDS-0 connected 1366x768+1280+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768       60.1*+
HDMI-0 disconnected (normal left inverted right x axis y axis)

Guess that it is not an error =P.

Offline

#17 2013-02-19 17:52:56

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] ARandR problem

VGA-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm

That's the line which is throwing the curve balls. arandr expects the 3rd "word" to be the resolution and offset. In your case it's the word "primary", it then fails parsing what it thinks is the resolution.

There's a todo note in the code saying this parsing should be replaced with reading the output using --verbose or using a library. It's exactly this undone todo that's biting you.

I think the following will fix your issue. In /usr/lib/python2.7/site-packages/screenlayout/xrandr.py, change line 126 from:

            hsplit = headline.split(" ")

to

            hsplit = headline.replace("primary ", "").split(" ")

If it does, this fix should be reported upstream and perhaps to the Arch bugtracker.

Hopefully you don't run into more python problems later in the execution of arandr.

Last edited by SidK (2013-02-19 18:40:16)

Offline

#18 2013-02-19 18:22:59

Micah89
Member
Registered: 2011-05-01
Posts: 29

Re: [SOLVED] ARandR problem

Yeh, i was kinda looking into that file also, but that fix worked, so report to upstream and arch bugtracker?

EDIT: I did not try to setup another monitor, because i dont have another monitor where i am, but at least it launched the program

Last edited by Micah89 (2013-02-19 18:25:01)

Offline

#19 2013-02-19 18:44:14

SidK
Member
Registered: 2011-03-03
Posts: 116

Re: [SOLVED] ARandR problem

I've emailed upstream with the 2 patches.

Offline

#20 2013-02-19 21:47:51

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: [SOLVED] ARandR problem

Hi SidK. Here's what I get with arandr from the repos

% arandr
Traceback (most recent call last):
  File "/usr/bin/arandr", line 42, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 318, in main
    force_version=options.force_version
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 159, in __init__
    self.filetemplate = self.widget.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/widget.py", line 93, in load_from_x
    self._xrandr.load_from_x()
  File "/usr/lib/python2.7/site-packages/screenlayout/xrandr.py", line 135, in load_from_x
    geometry = Geometry(hsplit[2])
  File "/usr/lib/python2.7/site-packages/screenlayout/auxiliary.py", line 81, in __new__
    width,rest = width.split("x")
ValueError: need more than 1 value to unpack

where xrandr outputs

% xrandr
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 270mm x 150mm
   1366x768       60.0*+
   1280x720       59.9  
   1152x768       59.8  
   1024x768       59.9  
   800x600        59.9  
   848x480        59.7  
   720x480        59.7  
   640x480        59.4  
HDMI-0 disconnected (normal left inverted right x axis y axis)
VGA-0 disconnected (normal left inverted right x axis y axis)

After applying your patch arandr shows

% arandr
Traceback (most recent call last):
  File "/usr/bin/arandr", line 41, in <module>
    from screenlayout.gui import main
  File "/usr/lib/python2.7/site-packages/screenlayout/gui.py", line 25, in <module>
    from . import widget
  File "/usr/lib/python2.7/site-packages/screenlayout/widget.py", line 24, in <module>
    from .xrandr import XRandR
  File "/usr/lib/python2.7/site-packages/screenlayout/xrandr.py", line 126
    hsplit = headline.replace("primary ", "").split(" ")
    ^
IndentationError: unexpected indent

Offline

#21 2013-02-19 21:54:47

Micah89
Member
Registered: 2011-05-01
Posts: 29

Re: [SOLVED] ARandR problem

That's just a python coding error, because blocks of code in python are defined by identation instead of brackets (or something alike).

Make sure that that line has the same number of leading spaces as the line above. Counting from the left edge of your editor.

Last edited by Micah89 (2013-02-19 21:59:30)

Offline

#22 2013-02-20 13:28:07

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: [SOLVED] ARandR problem

Ok, right, I don't really know python, but I DO know about the indentation, so I should have read the output properly. The patch works.

Offline

#23 2013-02-26 15:07:27

micer
Member
Registered: 2012-05-14
Posts: 12

Re: [SOLVED] ARandR problem

Hi guys,

I had the same problem as Micah89 and Army and I can confirm that SidK's fix works good also for two monitors. Thanks!

Offline

Board footer

Powered by FluxBB