Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Asynchronous (non-blocking) I/O for subprocesses in Python

morgan_greywolf (835522) writes | more than 5 years ago

Programming 1

In case you're just immediately drooling to find the answer to this conundrum, I found it on ASPN: a module to allow asynchronous subprocess I/O through a pipe that works on both POSIX and Windows.

In case you're just immediately drooling to find the answer to this conundrum, I found it on ASPN: a module to allow asynchronous subprocess I/O through a pipe that works on both POSIX and Windows.

Anyway the full story: I started looking up the necessary pywin32 calls (along with their corresponding C Win32 API calls, since the pywin32 documentation sucks) to do it -- I knew I might need to create a pipe with CreatePipe and set it as FILE_FLAG_OVERLAPPED and then pass it CreateProcess via the startupinfo parameter. I then figured out that I could do most of this by subclassing subprocess.Popen. I also found PeekNamedPipe, which also might do what I needed ... and then, voila, after searching for some Python/Pywin32 examples that used a few of these API calls, I came across the above-linked recipe on ASPN.

(I already knew I could achieve what I wanted on Unix by subclassing Popen and using select and fcntl and knew how to do it. It was just convenient that the above happened to already be using the technique for POSIX OSes)

It would be really cool if that noah guy could add support for this technique in Pexpect, and in fact, it's the next logical step. I may, for my project, end up subclassing Pexpect to write my own implementation using asynchronous pipe I/O rather than a pty. This has several disadvantages, I know, but for most of what I use Expect or Pexpect for, it won't make one bit of difference.

One thing, though, is that I don't know if there is any problem with using code posted on ASPN in a GPL v2 or v3 application. Anyone know the details? And, there seem to be some disdvantages listed on the linked article, such as Cygwin's bash and sh not displaying prompts and problems with Python code on Windows. Anyone know how to fix those?

cancel ×

1 comment

Sorry! There are no comments related to the filter you selected.

Barack Hussein Obama (0)

Anonymous Coward | more than 5 years ago | (#25591865)

A couple weeks ago, while browsing around the library downtown, I had to take a piss. As I entered the john, Barack Obama -- the messiah himself -- came out of one of the booths. I stood at the urinal looking at him out of the corner of my eye as he washed his hands. He didn't once look at me. He was busy and in any case I was sure the secret service wouldn't even let me shake his hand.

As soon as he left I darted into the booth he'd vacated, hoping there might be a lingering smell of shit and even a seat still warm from his sturdy ass. I found not only the smell but the shit itself. He'd forgotten to flush. And what a treasure he had left behind. Three or four beautiful specimens floated in the bowl. It apparently had been a fairly dry, constipated shit, for all were fat, stiff, and ruggedly textured. The real prize was a great feast of turd -- a nine inch gastrointestinal triumph as thick as his cock -- or at least as I imagined it!

I knelt before the bowl, inhaling the rich brown fragrance and wondered if I should obey the impulse building up inside me. I'd always been a liberal democrat and had been on the Obama train since last year. Of course I'd had fantasies of meeting him, sucking his cock and balls, not to mention sucking his asshole clean, but I never imagined I would have the chance. Now, here I was, confronted with the most beautiful five-pound turd I'd ever feasted my eyes on, a sausage fit to star in any fantasy and one I knew to have been hatched from the asshole of Barack Obama, the chosen one.

Why not? I plucked it from the bowl, holding it with both hands to keep it from breaking. I lifted it to my nose. It smelled like rich, ripe limburger (horrid, but thrilling), yet had the consistency of cheddar. What is cheese anyway but milk turning to shit without the benefit of a digestive tract?

I gave it a lick and found that it tasted better then it smelled.

I hesitated no longer. I shoved the fucking thing as far into my mouth as I could get it and sucked on it like a big half nigger cock, beating my meat like a madman. I wanted to completely engulf it and bit off a large chunk, flooding my mouth with the intense, bittersweet flavor. To my delight I found that while the water in the bowl had chilled the outside of the turd, it was still warm inside. As I chewed I discovered that it was filled with hard little bits of something I soon identified as peanuts. He hadn't chewed them carefully and they'd passed through his body virtually unchanged. I ate it greedily, sending lump after peanutty lump sliding scratchily down my throat. My only regret was that Barack Obama wasn't there to see my loyalty and wash it down with his piss.

I soon reached a terrific climax. I caught my cum in the cupped palm of my hand and drank it down. Believe me, there is no more delightful combination of flavors than the hot sweetness of cum with the rich bitterness of shit. It's even better than listening to an Obama speech!

Afterwards I was sorry that I hadn't made it last longer. But then I realized that I still had a lot of fun in store for me. There was still a clutch of virile turds left in the bowl. I tenderly fished them out, rolled them into my handkerchief, and stashed them in my briefcase. In the week to come I found all kinds of ways to eat the shit without bolting it right down. Once eaten it's gone forever unless you want to filch it third hand out of your own asshole. Not an unreasonable recourse in moments of desperation or simple boredom.

I stored the turds in the refrigerator when I was not using them but within a week they were all gone. The last one I held in my mouth without chewing, letting it slowly dissolve. I had liquid shit trickling down my throat for nearly four hours. I must have had six orgasms in the process.

I often think of Barack Obama dropping solid gold out of his sweet, pink asshole every day, never knowing what joy it could, and at least once did, bring to a grateful democrat.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>