Re: [Tutor] gnupg within a for loop

2014-06-02 Thread Adam Gold
On 02/06/14 01:35, Danny Yoo wrote: >> Thanks Danny, that was spot on. I actually used os.chdir to change to >> the base directory (which I assigned to a variable) just before the open >> statement. I don't know if that's 'pythonically' correct but it seemed >> like a simple way to do it. Again,

Re: [Tutor] gnupg within a for loop

2014-06-02 Thread Adam Gold
On 01/06/14 18:28, Danny Yoo wrote: > Hi Adam, > > Ah; I've seen this before. Make sure the file name is either relative > to current working directory, or make the file name absolute. What's > happening is that os.listdir() is giving you file names that are > relative to the base directory you

Re: [Tutor] gnupg within a for loop

2014-06-01 Thread Danny Yoo
> Thanks Danny, that was spot on. I actually used os.chdir to change to > the base directory (which I assigned to a variable) just before the open > statement. I don't know if that's 'pythonically' correct but it seemed > like a simple way to do it. Again, thank you for helping me fix this. I am

Re: [Tutor] gnupg within a for loop

2014-06-01 Thread Alan Gauld
On 01/06/14 17:22, Wolfgang Maier wrote: The really basic thing is that os.listdir returns the file names it finds in the specified directory, but that does not include the path to the file again. So the first element of unencrypted in your case is just 'file1' and that doesn't seem to exist in

Re: [Tutor] gnupg within a for loop

2014-06-01 Thread Wolfgang Maier
Adam Gold gmx.com> writes: > > I start with the following which can be used to encrypt a single file > (assume I have the indentations correct in the actual code, I can't seem > to modify the wrapping with my email client): > > phrase = '12345' > cipher = 'AES256' > gpg = gnupg.GPG(gnupghome='

Re: [Tutor] gnupg within a for loop

2014-06-01 Thread Danny Yoo
Hi Adam, Ah; I've seen this before. Make sure the file name is either relative to current working directory, or make the file name absolute. What's happening is that os.listdir() is giving you file names that are relative to the base directory you've passed it, but open() doesn't know about the

Re: [Tutor] gnupg within a for loop

2014-06-01 Thread Jim Byrnes
On 06/01/2014 07:01 AM, Adam Gold wrote: Hi there. I'm trying to do the following using python 3: create a list from all files in a particular directory, then loop over that list symmetrically encrypting each file using the gnupg module (note, for the moment I'm embedding the passphrase in the c