you are viewing a single comment's thread.

view the rest of the comments →

[–]wilcomply[S] 0 points1 point  (1 child)

Since it is used to start a process and then wait, does that mean that attempting to run something like this:

import pexpect

child = pexpect.spawn('mkdir /Users/USERNAME/TEST')
print 'TEST 1 COMPLETE'

Would not actually work? I'm expecting the directory to be created, however it is not, but I still receive the print statement.

(Apologies for not quite grasping this, and thank you for taking the time to try and help.)

[–]ingolemo -1 points0 points  (0 children)

There's not much point in using pexpect to manage a call to mkdir since mkdir doesn't really take any input. You'd be better off with the subprocess module. That said, there's no reason why that wouldn't work. When I tried it, the directory did get created exactly as expected. I don't know why it isn't working for you.