python: fatal io error 11 (resource temporarily unavailable) on x server :0.0

  • Last Update :
  • Techknowledgy :

The only change I needed was to import animate (from wx import animate) in addition to wx and use

showclock = animate.GIFAnimationCtrl(self, -1, clock)

instead of

showclock = wx.animate.GIFAnimationCtrl(self, -1, clock)

Don't know if it's related to your problem but you should instantiate the dialog and call its ShowModal after the wxApp is created:

class App(wx.App):
   def OnInit(self):
   dia = AniGif(None, -1, "Ani Gif")
try:
dia.ShowModal()
finally:
dia.Destroy()
return True

App(0).MainLoop()

I didn't see you instantiated a wx.Bitmap from another thread. This is bad. Try this instead:

def grabImages():
   global dirim
dirim = {}
def addToDict(key, path):
   dirim[key] = wx.Bitmap(path)
path = './images/soccer/'
listing = os.listdir(path)
for infile in listing:
   if len(infile) > 4 and infile[-4: ] == '.jpg':
   print path + infile
wx.CallAfter(addToDict, infile, path + infile)

Suggestion : 2

I tested the code in a Python terminal and it works. In Autokey, the app crashes.,Please run dmesg -T in a terminal immediately after running your script and post the last 20 lines or so of it so we can see if the system noticed any errors.,I know that Wnck is old, but it works and Python accepted it. All I wanted is to get the experts' attention, but please don't spend any time on it. The script started to function again.,Renamed this. The original title refers to a benign error message which has persisted for over a decade with no consequences and has been eliminated in 0.96. Also copied your script into the question for ease of reference.

# win + INS insert current date, time, and filename

import os, time, datetime, gi, threading

ts = time.time()
time_stamp = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M') + " - "

gi.require_version("Wnck", "3.0")
from gi.repository
import Wnck

time.sleep(0.2)
scr = Wnck.Screen.get_default()
time.sleep(0.2)
scr.force_update()
time.sleep(0.2)
active = (scr.get_active_window().get_name())
keyboard.send_keys(time_stamp + " " + active)

Suggestion : 3

I am trying to read some Images(and later intend to do some task on them), and while Images are being read into memory. I want to display a animated '.gif' Image. For that purpose I had to use Threads. Now it is giving Error :,The display of third-party trademarks and trade names on this site does not necessarily indicate any affiliation or endorsement of FaqCode4U.com.,Please tell what is happening in this code .. and suggest a solution I am using ubuntu 10.04 OS. And directory permissions are :,I have tried removing ~/.gconf/desktop/gnome/peripherals as mentioned in the link given by joaquin. It doesn't work .. and I also tried 'xhost +' . I found from somewhere on the net. Still no success.


python: Fatal IO error 11(Resource temporarily unavailable) on X server: 0.0.
python: Fatal IO error 11(Resource temporarily unavailable) on X server: 0.0.
python: Fatal IO error 0(Success) on X server: 0.0.
import wx from wx
import animate
import thread
import os class AniGif(wx.Dialog): def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title, size = (300, 300)) buttonOk = wx.Button(self, id = 3, label = "Ok", pos = (75, 50), size = (50, 50)) self.Bind(wx.EVT_BUTTON, self.OnClick, id = 3) def OnClick(self, event): clock = "loading.gif"
showclock = wx.animate.GIFAnimationCtrl(self, -1, clock) showclock.Play() thread.start_new_thread(grabImages, ()) def grabImages(): global dirimdirim = {}
path = './images/soccer/'
listing = os.listdir(path) for infile in listing: if len(infile) > 4 and infile[-4: ] == '.jpg': print path + infile dirim[infile] = wx.Bitmap(path + infile) app = wx.App() dia = AniGif(None, -1, "Ani Gif") dia.ShowModal() dia.Destroy() app.MainLoop()
dirim[infile] = wx.Bitmap(path + infile)
dirim[infile] = infile