← Back to team overview

yade-dev team mailing list archive

[Bug 1223348] Re: Yade starts without graphical interface

 

** Description changed:

  Today I stumbled upon a bug in the startup script of Yade[1]. In my eyes
  this bug won't affect a lot of people.
  
  I created a new user User1 on our Yade-Server. This user will run yade via remote connection (from ubuntu 12.04 LTS using rdesktop).
  (To be more precise the setup is that: windows XP 32 bit dektop computer -> VirtualBox virtual machine using Ubuntu 12.04 LTS 32bit -> Yade-Server)
  
  Starting Yade-Daily as User1 ends up in the noGui Version of Yade. You can start Yade in this version using the -n argument at startup:
  yade-daily -n
  
  There is no error message or warning. You just wont be able to start the qtController or 3D View.
  According to [1]l ines 233-250 this will happen, if gui is not part of "features". After calling features in yade this could be declined. Checking yade.runtime.hasDisplay gives False. So it was obvious that an error was raised during Xlib.display._BaseDisplay().
  After starting a python console and importing the Xlib module, a call of Xlib.display._BaseDisplay() ends up in an error [2]
  I simply created an empty .Xauthority file:
  touch ~/.Xauthority
  
  After this things worked as they were expected to.
+ Just for double checking: if you start a python console, import Xlib and call Xlib.display._BaseDisplay(), you'll get:
+ Xlib.xauth: warning, no xauthority details available
+ <Xlib.display._BaseDisplay instance at 0x7ff5761525a8>
  
- I'm not sure whether this solution can somehow be implemented at the
- startup of yade. At least a Warning should be raised if graphics are
- disabled. The Xauthority thing is mentioned in the comments but the user
- should be informed, too.
+ 
+ I'm not sure whether this solution can somehow be implemented at the startup of yade. At least a Warning should be raised if graphics are disabled. The Xauthority thing is mentioned in the comments but the user should be informed, too.
  
  --------------
  [1]https://github.com/yade/trunk/blob/master/core/main/main.py.in
  especially lines 233-250:
  "## run userSession in a way corresponding to the features we use:
  gui=None
  yade.runtime.hasDisplay=False # this is the default initialized in the module, anyway
  if 'qt4' in features: gui='qt4'
  if opts.nogui: gui=None
  if gui:
- 	import Xlib.display
- 	# PyQt4's QApplication does exit(1) if it is unable to connect to the display
- 	# we however want to handle this gracefully, therefore
- 	# we test the connection with bare xlib first, which merely raises DisplayError
- 	try:
- 		# contrary to display.Display, _BaseDisplay does not check for extensions and that avoids spurious message "Xlib.protocol.request.QueryExtension" (bug?)
- 		Xlib.display._BaseDisplay();
- 		yade.runtime.hasDisplay=True
- 	except: 
- 		# usually Xlib.error.DisplayError, but there can be Xlib.error.XauthError etc as well
- 		# let's just pretend any exception means the display would not work
- 		gui=None
+  import Xlib.display
+  # PyQt4's QApplication does exit(1) if it is unable to connect to the display
+  # we however want to handle this gracefully, therefore
+  # we test the connection with bare xlib first, which merely raises DisplayError
+  try:
+   # contrary to display.Display, _BaseDisplay does not check for extensions and that avoids spurious message "Xlib.protocol.request.QueryExtension" (bug?)
+   Xlib.display._BaseDisplay();
+   yade.runtime.hasDisplay=True
+  except:
+   # usually Xlib.error.DisplayError, but there can be Xlib.error.XauthError etc as well
+   # let's just pretend any exception means the display would not work
+   gui=None
  "
  
- [2] to be added later
+ [2] 
+ user1@ubuntu:~$ python
+ Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
+ [GCC 4.6.3] on linux2
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>> import Xlib.display
+ >>> xlib.display._BaseDisplay()
+ Traceback (most recent call last):
+   File "<stdin>", line 1, in <module>
+ NameError: name 'xlib' is not defined
+ >>> Xlib.display._BaseDisplay()
+ Traceback (most recent call last):
+   File "<stdin>", line 1, in <module>
+   File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 65, in __init__
+     apply(protocol.display.Display.__init__, (self, ) + args, keys)
+   File "/usr/lib/pymodules/python2.7/Xlib/protocol/display.py", line 52, in __init__
+     name, host, displayno)
+   File "/usr/lib/pymodules/python2.7/Xlib/support/connect.py", line 94, in get_auth
+     return mod.get_auth(sock, dname, host, dno)
+   File "/usr/lib/pymodules/python2.7/Xlib/support/unix_connect.py", line 117, in new_get_auth
+     au = xauth.Xauthority()
+   File "/usr/lib/pymodules/python2.7/Xlib/xauth.py", line 44, in __init__
+     raise error.XauthError('~/.Xauthority: %s' % err)
+ Xlib.error.XauthError: ~/.Xauthority: [Errno 2] No such file or directory: '/home/felix/.Xauthority'

-- 
You received this bug notification because you are a member of Yade
developers, which is subscribed to Yade.
https://bugs.launchpad.net/bugs/1223348

Title:
  Yade starts without graphical interface

Status in Yet Another Dynamic Engine:
  In Progress

Bug description:
  Today I stumbled upon a bug in the startup script of Yade[1]. In my
  eyes this bug won't affect a lot of people.

  I created a new user User1 on our Yade-Server. This user will run yade via remote connection (from ubuntu 12.04 LTS using rdesktop).
  (To be more precise the setup is that: windows XP 32 bit dektop computer -> VirtualBox virtual machine using Ubuntu 12.04 LTS 32bit -> Yade-Server)

  Starting Yade-Daily as User1 ends up in the noGui Version of Yade. You can start Yade in this version using the -n argument at startup:
  yade-daily -n

  There is no error message or warning. You just wont be able to start the qtController or 3D View.
  According to [1]l ines 233-250 this will happen, if gui is not part of "features". After calling features in yade this could be declined. Checking yade.runtime.hasDisplay gives False. So it was obvious that an error was raised during Xlib.display._BaseDisplay().
  After starting a python console and importing the Xlib module, a call of Xlib.display._BaseDisplay() ends up in an error [2]
  I simply created an empty .Xauthority file:
  touch ~/.Xauthority

  After this things worked as they were expected to.
  Just for double checking: if you start a python console, import Xlib and call Xlib.display._BaseDisplay(), you'll get:
  Xlib.xauth: warning, no xauthority details available
  <Xlib.display._BaseDisplay instance at 0x7ff5761525a8>

  
  I'm not sure whether this solution can somehow be implemented at the startup of yade. At least a Warning should be raised if graphics are disabled. The Xauthority thing is mentioned in the comments but the user should be informed, too.

  --------------
  [1]https://github.com/yade/trunk/blob/master/core/main/main.py.in
  especially lines 233-250:
  "## run userSession in a way corresponding to the features we use:
  gui=None
  yade.runtime.hasDisplay=False # this is the default initialized in the module, anyway
  if 'qt4' in features: gui='qt4'
  if opts.nogui: gui=None
  if gui:
   import Xlib.display
   # PyQt4's QApplication does exit(1) if it is unable to connect to the display
   # we however want to handle this gracefully, therefore
   # we test the connection with bare xlib first, which merely raises DisplayError
   try:
    # contrary to display.Display, _BaseDisplay does not check for extensions and that avoids spurious message "Xlib.protocol.request.QueryExtension" (bug?)
    Xlib.display._BaseDisplay();
    yade.runtime.hasDisplay=True
   except:
    # usually Xlib.error.DisplayError, but there can be Xlib.error.XauthError etc as well
    # let's just pretend any exception means the display would not work
    gui=None
  "

  [2] 
  user1@ubuntu:~$ python
  Python 2.7.3 (default, Aug  1 2012, 05:14:39) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import Xlib.display
  >>> xlib.display._BaseDisplay()
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  NameError: name 'xlib' is not defined
  >>> Xlib.display._BaseDisplay()
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 65, in __init__
      apply(protocol.display.Display.__init__, (self, ) + args, keys)
    File "/usr/lib/pymodules/python2.7/Xlib/protocol/display.py", line 52, in __init__
      name, host, displayno)
    File "/usr/lib/pymodules/python2.7/Xlib/support/connect.py", line 94, in get_auth
      return mod.get_auth(sock, dname, host, dno)
    File "/usr/lib/pymodules/python2.7/Xlib/support/unix_connect.py", line 117, in new_get_auth
      au = xauth.Xauthority()
    File "/usr/lib/pymodules/python2.7/Xlib/xauth.py", line 44, in __init__
      raise error.XauthError('~/.Xauthority: %s' % err)
  Xlib.error.XauthError: ~/.Xauthority: [Errno 2] No such file or directory: '/home/felix/.Xauthority'

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/1223348/+subscriptions


References