<div dir="ltr"><span style="font-size:12.8px">Hi Everyone,</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I am developing a tiny library where you can use your gpio pins (over sysfs) in twisted way. You may find more about, on <a href="https://github.com/sardok/txgpio" target="_blank">https://github.com/sardok/txgpio</a>.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I am facing with a race condition issue, where certain files are needed to be created in filesystem, by kernel, in order have the class to finish its initialization. Which means in twisted jargon, a deferred needs to be resolved in __init__ (or another method - see below) method in order to have complete object.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">After reading this blog post <a href="http://as.ynchrono.us/2014/12/asynchronous-object-initialization.html" target="_blank">http://as.ynchrono.us/2014/12/asynchronous-object-initialization.html</a> by Jean-Paul, i believe having 'from_' factory method which waits for those certain files to be created before creating the actual class object is the better way.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">However, i couldn't find a way to wait for a deferred in order to use the from_ function in the following form (which is the common form for using from_ factory methods);</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">obj = sysfs.GPIO.from_unexported_node(*a, **kw)</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">More or less, i am looking for some thing equivalent of '<span style="font-size:13.2px;line-height:18.48px">asyncio.get_event_loop()' and '</span><span style="font-size:13.2px;line-height:18.48px">yield from loop.run_in_executor()' as mentioned in the blog post.</span></div><div style="font-size:12.8px"><span style="font-size:13.2px;line-height:18.48px"><br></span></div><div style="font-size:12.8px"><span style="font-size:13.2px;line-height:18.48px">Thanks,</span></div><div style="font-size:12.8px"><span style="font-size:13.2px;line-height:18.48px">Sinan.</span></div></div>