[Tutor] beginner pexpect question

Nathan McBride nomb85 at comcast.net
Wed Feb 13 17:37:30 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey guys,

I'm practically still a beginner with python.  I am working on a program
that originally I used popen for but then switched to pexpect because it
was easier for me to understand.
I was hoping someone could help me get this working:

I do a:

child = pexpect.spawn ('cryptsetup --verbose --cipher
"aes-cbc-essiv:sha256" --key-size 256 --verify-passphrase luksFormat ' +
self.loopdevice)
        i = child.expect ([pexpect.TIMEOUT, '.*'])
        if i == 0:
            print 'ERROR!'
            print child.before, child.after
        child.sendline ('YES')
        print "Sent YES"
        child.expect ('.*')
        #child.sendline ('Test')
        child.send ('Test\n')
        print "Sent Pass 1"
        child.expect ('.*')
        child.send ('Test\n')
        print "Sent Pass 2"
        #child.sendline ('Test')

This runs without errors but then to test I do a:

[root at localhost project]# losetup /dev/loop0 /home/user/deleteme
[root at localhost project]# cryptsetup luksOpen /dev/loop0 encr-container1
Enter LUKS passphrase:
/dev/loop0 is not a LUKS partition
Command failed: No key available with this passphrase.

I can't understand this at all.  If anyone can help I would appreciate
it a lot.

Thanks very much,
Nate

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHsxnq/n+duykW6K8RAufNAKDP3BNCDAC/ALFuH8ht8qyETy5/xQCfS4i7
2aA9UoTLBZDRst0LPA9YstM=
=rcB6
-----END PGP SIGNATURE-----



More information about the Tutor mailing list