You are not logged in.
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
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
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
Visuallyx
Last edited by ackt1c (2022-11-05 15:23:03)
Offline
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
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
thanks, patch the file does solve the problem,
Offline
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
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
I've found the same problem than Army:
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
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
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
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
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
It runs xrandr with no parameters. Sorry, I should have made this clearer from the start.
Please do:
$ xrandr
Paste the results here.
Offline
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
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
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
I've emailed upstream with the 2 patches.
Offline
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
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
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
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