Coder Social home page Coder Social logo

Comments (7)

phillipberndt avatar phillipberndt commented on May 23, 2024

Thanks for filing this report!

  • What is on line 1343 in your autorandr.py? Mine only has 1058 lines.
  • If you run autorandr with the --debug flag it will print which commands exactly it attempts to execute.
  • Does executing those commands manually from a command line work for you?

from autorandr.

eseca avatar eseca commented on May 23, 2024

Mine has only 1058 lines as well. I don't know why the error message says line 1343.

this is what happens when using the --debug flag.

 $ autorandr --change --force --debug
jaque (detected) (current)
| Differences between the two profiles:
\-
laptop
docked
ultrawide
Going to run:
Failed to apply profile 'jaque' (line 1343):
  [Errno 8] Exec format error
This appears to be a bug. Please help improving autorandr by reporting it upstream:
https://github.com/phillipberndt/autorandr/issues
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

from autorandr.

phillipberndt avatar phillipberndt commented on May 23, 2024

The latest master version should give you a better error message (containing the file where the error occurred; obviously it's not autorandr.py).

Also, please try patching the function call_and_retry starting in line 554: Above line 572, which says

retval = subprocess.call(*args, **kwargs_redirected)

Add

print({ "args": args, "kwargs": kwargs_redirected})

This should output the command that is being run. Does calling it manually work?

from autorandr.

eseca avatar eseca commented on May 23, 2024

This is how my call_and_retry function looks like (did pull):

 553 def call_and_retry(*args, **kwargs):                                             
 554     """Wrapper around subprocess.call that retries failed calls.                 
 555                                                                                  
 556     This function calls subprocess.call and on non-zero exit states,             
 557     waits a second and then retries once. This mitigates #47,                    
 558     a timing issue with some drivers.                                            
 559     """                                                                          
 560     kwargs_redirected = dict(kwargs)                                             
 561     if hasattr(subprocess, "DEVNULL"):                                           
 562         kwargs_redirected["stdout"] = getattr(subprocess, "DEVNULL")             
 563     else:                                                                        
 564         kwargs_redirected["stdout"] = open(os.devnull, "w")                      
 565     kwargs_redirected["stderr"] = kwargs_redirected["stdout"]                    
 566     retval = subprocess.call(*args, **kwargs_redirected)                         
 567     if retval != 0:                                                              
 568         time.sleep(1)                                                            
 569         retval = subprocess.call(*args, **kwargs)                                
 570     return retval                                                                

Added the print

 553 def call_and_retry(*args, **kwargs):                                             
 554     """Wrapper around subprocess.call that retries failed calls.                 
 555                                                                                  
 556     This function calls subprocess.call and on non-zero exit states,             
 557     waits a second and then retries once. This mitigates #47,                    
 558     a timing issue with some drivers.                                            
 559     """                                                                          
 560     kwargs_redirected = dict(kwargs)                                             
 561     if hasattr(subprocess, "DEVNULL"):                                           
 562         kwargs_redirected["stdout"] = getattr(subprocess, "DEVNULL")             
 563     else:                                                                        
 564         kwargs_redirected["stdout"] = open(os.devnull, "w")                      
 565     kwargs_redirected["stderr"] = kwargs_redirected["stdout"]                    
 566     print({ "args": args, "kwargs": kwargs_redirected})                          
 567     retval = subprocess.call(*args, **kwargs_redirected)                         
 568     if retval != 0:                                                              
 569         time.sleep(1)                                                            
 570         retval = subprocess.call(*args, **kwargs)                                
 571     return retval                                                                

Then:

 $ autorandr --change --force                                                           [01:54:33]
aguila (detected) (current)
jaque (current)
laptop
docked
ultrawide
{'args': (['xrandr', '--output', 'DP1', '--gamma', '1.0:1.0:1.0', '--mode', '1920x1200', '--panning', '0x0', '--pos', '0x0', '--rate', '59.95', '--reflect', 'normal', '--rotate', 'normal', '--output', 'HDMI2', '--gamma', '1.0:1.0:1.0', '--mode', '1920x1200', '--panning', '0x0', '--pos', '1920x0', '--rate', '59.95', '--reflect', 'normal', '--rotate', 'normal'],), 'kwargs': {'stderr': <open file '/dev/null', mode 'w' at 0x7fa35987f6f0>, 'stdout': <open file '/dev/null', mode 'w' at 0x7fa35987f6f0>}}
{'args': (['xrandr', '--output', 'eDP1', '--gamma', '1.0:1.0:1.0', '--mode', '1920x1080', '--panning', '0x0', '--pos', '0x1200', '--rate', '60.06', '--reflect', 'normal', '--rotate', 'normal'],), 'kwargs': {'stderr': <open file '/dev/null', mode 'w' at 0x7fa35987f6f0>, 'stdout': <open file '/dev/null', mode 'w' at 0x7fa35987f6f0>}}
Failed to apply profile 'aguila' (line 1343; /usr/lib/python2.7/subprocess.py):
  [Errno 8] Exec format error
This appears to be a bug. Please help improving autorandr by reporting it upstream:
https://github.com/phillipberndt/autorandr/issues
Please attach the output of `xrandr --verbose` to your bug report if appropriate.

Note: I added a new profile aguila that supersets jaque. The latter is the one I was using originally.

from autorandr.

phillipberndt avatar phillipberndt commented on May 23, 2024

Interesting; so the first command works and the second raises an OS error..

So what exactly happens if you run

xrandr --output DP1 --gamma 1.0:1.0:1.0 --mode 1920x1200 --panning 0x0 --pos 0x0 --rate 59.95 --reflect normal --rotate normal --output HDMI2 --gamma 1.0:1.0:1.0 --mode 1920x1200 --panning 0x0 --pos 1920x0 --rate 59.95 --reflect normal --rotate normal && \
xrandr --output eDP1 --gamma 1.0:1.0:1.0 --mode 1920x1080 --panning 0x0 --pos 0x1200 --rate 60.06 --reflect normal --rotate normal

Does this work without raising any errors?

Another thing, please try replacing "xrandr" in the script with the absolute path to xrandr, i.e. "/usr/bin/xrandr"

Third idea: Do you by any chance have a postswitch / preswitch / etc. script in your configuration? Does running that script manually (directly, i.e. /path/to/postswitch instead of sh /path/to/postswitch) work?

from autorandr.

eseca avatar eseca commented on May 23, 2024

Went directly to third idea. This was my ~/.autorandr/postswitch:

#!/bin/bash

~/.config/bspwm/scripts/refresh_monitors.sh

Which just calls more scripts, one of them did rise some errors. So I redirected outputs.

#!/bin/bash

~/.config/bspwm/scripts/refresh_monitors.sh &> /dev/null

And now it works just fine. So it was my bad.

from autorandr.

phillipberndt avatar phillipberndt commented on May 23, 2024

Good to hear. That still means that I should improve the error message. I just pushed a commit that should state which script exactly failed.

from autorandr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.