Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85996 > unrolled thread

subprocess command fails

Started byBrad s <bcddd214@gmail.com>
First post2015-02-20 15:30 -0800
Last post2015-02-20 22:41 -0800
Articles 7 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  subprocess command fails Brad s <bcddd214@gmail.com> - 2015-02-20 15:30 -0800
    Re: subprocess command fails Cameron Simpson <cs@zip.com.au> - 2015-02-21 12:11 +1100
    Re: subprocess command fails Brad s <bcddd214@gmail.com> - 2015-02-20 20:47 -0800
      Re: subprocess command fails Larry Hudson <orgnut@yahoo.com> - 2015-02-21 12:33 -0800
    Re: subprocess command fails Brad s <bcddd214@gmail.com> - 2015-02-20 21:14 -0800
      Re: subprocess command fails Cameron Simpson <cs@zip.com.au> - 2015-02-21 17:47 +1100
    Re: subprocess command fails Brad s <bcddd214@gmail.com> - 2015-02-20 22:41 -0800

#85996 — subprocess command fails

FromBrad s <bcddd214@gmail.com>
Date2015-02-20 15:30 -0800
Subjectsubprocess command fails
Message-ID<c03d11a3-33d3-4b8c-a966-34181e1b5bfd@googlegroups.com>
# cat makekeys.py
#!/usr/bin/python3.4
import subprocess
import sys
import string
import os.path
import datetime
import shlex
from time import gmtime, strftime
from subprocess import Popen, PIPE, STDOUT

pretime = strftime("%Y%m%d%H", gmtime())
time = datetime.datetime.strptime(pretime,'%Y%m%d%H')
print (time)
plustime = datetime.timedelta(days=730)
timeadd = (time + plustime)
str(timeadd)
#ndate = datetime.strptime(timeadd, '%Y%m%d%H')
#timeadd = timeadd.replace(tzinfo=UTC())
print (timeadd)

dname = input("Enter the domain to configure keys for? ")
if os.path.exists(dname+".external.signed"):
        os.remove(dname+".external.signed")
        #os.remove(dname+".external")
        os.remove(dname+".ksk.key")
        os.remove(dname+".zsk.key")
        os.remove(dname+".ksk.private")
        os.remove(dname+".zsk.private")
fd = open( dname+".external", 'w')
fd.write("$TTL 86400\n")
fd.write("$ORIGIN "+dname+".\n")
fd.write("@  1D  IN SOA yoda.ex-mailer.com.  admin@"+dname+".(\n")
fd.write("                      "+strftime("%Y%m%d%H", gmtime())+"\n")
#fd.write("                     "+repr(timeadd)+"\n")
fd.write("                      3h\n")
fd.write("                      1h\n")
fd.write("                      1w\n")
fd.write("                      1h)\n")
fd.write("                      IN NS   yoda.ex-mailer.com.\n")
fd.write("                      IN NS   r2d2.ex-mailer.com.\n")
fd.write(dname+".               IN TXT  v=spf1 mx a:r2d2.ex-mailer.com -all\n")
fd.write(dname+".               MX 0    r2d2.ex-mailer.com.\n")
fd.write("mail."+dname+".       IN A    107.191.60.48\n")
fd.write("$include /usr/local/etc/namedb/K"+dname+".zsk.key ; ZSK\n")
fd.write("$include /usr/local/etc/namedb/K"+dname+".ksk.key ; KSK\n")
fd.close()


result = subprocess.check_output(["dnssec-keygen", "-f", "KSK", "-r", "/dev/urandom", "-a", "RSASHA256", "-b", "2048", "-n", "ZONE", dname])
result_utf8 = result.decode("utf-8").strip()
mylist = list(result_utf8)
print (mylist[0])
listlen= len(mylist)
array = list()
listlen -= 11
i = 0
while( i < listlen ):
        #if mylist != '\n' ^ mylist != '':
        array.insert(i, mylist[i])
        i = i + 1
combined = "".join(array)
print ('combined')
print (combined)
fmove = subprocess.call(["mv", result_utf8+".key",combined +".ksk.key"])
fmove = subprocess.call(["mv", result_utf8+".private",combined +".ksk.private"])

zresult = subprocess.check_output(["dnssec-keygen","-r","/dev/urandom","-a","RSASHA256","-b","2048","-n","ZONE", dname])
zresult_utf8 = zresult.decode("utf-8").strip()
myzlist = list(zresult_utf8)
print (myzlist[0])
zlistlen= len(myzlist)
zarray = list()
zlistlen -= 11
zi = 0
while( zi <zlistlen ):
        zarray.insert(zi, myzlist[zi])
        zi = zi + 1
zcombined = "".join(zarray)
zfmove = subprocess.call(["mv", zresult_utf8+".key",zcombined+".zsk.key"])
zfmove = subprocess.call(["mv", zresult_utf8+".private",zcombined+".zsk.private"])

sfmove = subprocess.call(['dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k',zcombined+'.ksk.key','-o',dname,dname+'.external',zcombined+'.zsk.key'])
#cmd = "dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k','K'+dname+'.ksk.key','-o',dname,dname+'.external','K"+dname+'.zsk.key'
#subprocess.check_call(shlex.split(cmd))






# python3.4 makekeys.py
2015-02-20 23:00:00
2017-02-19 23:00:00
Enter the domain to configure keys for? test123.com
Generating key pair.........+++ ...............+++
K
combined
Ktest123.com
Generating key pair...+++ .........................................................+++
K
dnssec-signzone: fatal: No self-signed KSK DNSKEY found.  Supply an active
key with the KSK flag set, or use '-P'.

I am trying to execute a subprocess, something done in my script a couple of times. But on the last one, it outputs an error I cannot find the solution to. The exact same command using the same files produced at the command line works just fine.



command works on the command line:

dnssec-signzone -e20180330000000 -p -t -g -k Ktest123.com.ksk.key -o test123.com test123.com.external Ktest123.com.zsk.key
Verifying the zone using the following algorithms: RSASHA256.
Zone fully signed:
Algorithm: RSASHA256: KSKs: 1 active, 0 stand-by, 0 revoked
                      ZSKs: 1 active, 0 stand-by, 0 revoked
test123.com.external.signed
Signatures generated:                        9
Signatures retained:                         0
Signatures dropped:                          0
Signatures successfully verified:            0
Signatures unsuccessfully verified:          0
Signing time in seconds:                 0.010
Signatures per second:                 875.401
Runtime in seconds:                      0.013

[toc] | [next] | [standalone]


#86004

FromCameron Simpson <cs@zip.com.au>
Date2015-02-21 12:11 +1100
Message-ID<mailman.18940.1424481128.18130.python-list@python.org>
In reply to#85996
On 20Feb2015 15:30, Brad s <bcddd214@gmail.com> wrote:
>I am trying to execute a subprocess, something done in my script a couple of times. But on the last one, it outputs an error I cannot find the solution to.  The exact same command using the same files produced at the command line works just fine.
>

Hi Brad,

I have reordered your post in my quote for readability. It is best to ask your 
question and give some background first, then list offending output with a 
description of good output, then the code.

You write:

>The first command works on the command line:
>
>dnssec-signzone -e20180330000000 -p -t -g -k Ktest123.com.ksk.key -o test123.com test123.com.external Ktest123.com.zsk.key
>Verifying the zone using the following algorithms: RSASHA256.
>Zone fully signed:
>Algorithm: RSASHA256: KSKs: 1 active, 0 stand-by, 0 revoked
>                      ZSKs: 1 active, 0 stand-by, 0 revoked
>test123.com.external.signed
>Signatures generated:                        9
>Signatures retained:                         0
>Signatures dropped:                          0
>Signatures successfully verified:            0
>Signatures unsuccessfully verified:          0
>Signing time in seconds:                 0.010
>Signatures per second:                 875.401
>Runtime in seconds:                      0.013

Which is excellent.

Then you supply your code:

>sfmove = subprocess.call(['dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k',zcombined+'.ksk.key','-o',dname,dname+'.external',zcombined+'.zsk.key'])

I would start by pointing out that this is not identical to your shell command 
line. FOr example, your shell command line supplied the -e optin as 
"-e20180330000000", but your python code generates two strings: "-e", 
"20180330000000".

It may not matter, but it is not identically worded and some commands are picky 
about this kind of thing.

For debugging purposes I would do two things:

- compute the python command argument list as a separate list and print it out, example:

      cmdargv = [ 'dnssec-signzone',
                  '-e', strftime('%Y%m%d%H', gmtime())+'0000',
                  '-p', 
                  '-t',
                  '-g',
                  '-k', zcombined+'.ksk.key',
                  '-o', dname,
                  dname+'.external',
                  zcombined+'.zsk.key'
                ]
      print("command = %r" % (cmdargv,))
      sfmove = subprocess.call(cmdargv)

  Note the use of %r to print the contents of the command clearly.
  (BTW, "sfmove"? Surely "sign" or something.)

- hand run _exactly_ the command printed out by the print call above

If you run _exactly_ what your python comman did, you should be able to 
reproduce the error. Then debug on the command line. Then fix the python code 
accordingly.

>#cmd = "dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k','K'+dname+'.ksk.key','-o',dname,dname+'.external','K"+dname+'.zsk.key'
>#subprocess.check_call(shlex.split(cmd))

Remark: shlex.split is not a good way to make a command line unless it comand 
from some input line obtained from a user. Stick with your current "construct a 
list" approach: more robust.

I notice your code removes a bunch of files. Might it remove a necessary file 
for the command?

Cheers,
Cameron Simpson <cs@zip.com.au>

[toc] | [prev] | [next] | [standalone]


#86012

FromBrad s <bcddd214@gmail.com>
Date2015-02-20 20:47 -0800
Message-ID<86812014-73ad-466a-95ef-4257390b574b@googlegroups.com>
In reply to#85996
Yes, the program deletes the same files it produces. It looks to see if old stuff is there and if it exist, it deletes the files and creates and entirely new DNS zone with keys and then it is supposed to sign it.
The last step is where it is still failing but your code helped me to figure out why.
I am signing the zone with the current date/date (which is incorrect but was done for testing purposes.

I figured out how to add 2 years to the current data/time but I am unable to strip the formatting once I apply my + 2 years trick.

How can I add 2 years to stripped format date/time?


# dnssec-signzone -e20150221040000 -p -t -g -k Ktest123.com.ksk.key -o test123.com test123.com.external Ktest123.com.zsk.key
dnssec-signzone: fatal: No self-signed KSK DNSKEY found.  Supply an active
key with the KSK flag set, or use '-P'.
# dnssec-signzone -e20160221040000 -p -t -g -k Ktest123.com.ksk.key -o test123.com test123.com.external Ktest123.com.zsk.key
Verifying the zone using the following algorithms: RSASHA256.
Zone fully signed:
Algorithm: RSASHA256: KSKs: 1 active, 0 stand-by, 0 revoked
                      ZSKs: 1 active, 0 stand-by, 0 revoked
test123.com.external.signed
Signatures generated:                        9
Signatures retained:                         0
Signatures dropped:                          0
Signatures successfully verified:            0
Signatures unsuccessfully verified:          0
Signing time in seconds:                 0.014
Signatures per second:                 631.756
Runtime in seconds:                      0.018



current code:

# cat makekeys.py
#!/usr/bin/python3.4
import subprocess
import sys
import string
import os.path
import datetime
import shlex
from time import gmtime, strftime
from subprocess import Popen, PIPE, STDOUT

pretime = strftime("%Y%m%d%H", gmtime())
time = datetime.datetime.strptime(pretime,'%Y%m%d%H')
print (time)
plustime = datetime.timedelta(days=730)
timeadd = (time + plustime)
str(timeadd)
#ndate = datetime.strptime(timeadd, '%Y%m%d%H')
#timeadd = timeadd.replace(tzinfo=UTC())
print (timeadd)

dname = input("Enter the domain to configure keys for? ")
if os.path.exists(dname+".external.signed"):
        os.remove(dname+".external.signed")
        #os.remove(dname+".external")
        os.remove(dname+".ksk.key")
        os.remove(dname+".zsk.key")
        os.remove(dname+".ksk.private")
        os.remove(dname+".zsk.private")
fd = open( dname+".external", 'w')
fd.write("$TTL 86400\n")
fd.write("$ORIGIN "+dname+".\n")
fd.write("@  1D  IN SOA yoda.ex-mailer.com.  admin@"+dname+".(\n")
fd.write("                      "+strftime("%Y%m%d%H", gmtime())+"\n")
#fd.write("                     "+repr(timeadd)+"\n")
fd.write("                      3h\n")
fd.write("                      1h\n")
fd.write("                      1w\n")
fd.write("                      1h)\n")
fd.write("                      IN NS   yoda.ex-mailer.com.\n")
fd.write("                      IN NS   r2d2.ex-mailer.com.\n")
fd.write(dname+".               IN TXT  v=spf1 mx a:r2d2.ex-mailer.com -all\n")
fd.write(dname+".               MX 0    r2d2.ex-mailer.com.\n")
fd.write("mail."+dname+".       IN A    107.191.60.48\n")
fd.write("$include /usr/local/etc/namedb/K"+dname+".zsk.key ; ZSK\n")
fd.write("$include /usr/local/etc/namedb/K"+dname+".ksk.key ; KSK\n")
fd.close()


result = subprocess.check_output(["dnssec-keygen", "-f", "KSK", "-r", "/dev/urandom", "-a", "RSASHA256", "-b", "2048", "-n", "ZONE", dname])
result_utf8 = result.decode("utf-8").strip()
mylist = list(result_utf8)
print (mylist[0])
listlen= len(mylist)
array = list()
listlen -= 11
i = 0
while( i < listlen ):
        #if mylist != '\n' ^ mylist != '':
        array.insert(i, mylist[i])
        i = i + 1
combined = "".join(array)
print ('combined')
print (combined)
fmove = subprocess.call(["mv", result_utf8+".key",combined +".ksk.key"])
fmove = subprocess.call(["mv", result_utf8+".private",combined +".ksk.private"])

zresult = subprocess.check_output(["dnssec-keygen","-r","/dev/urandom","-a","RSASHA256","-b","2048","-n","ZONE", dname])
zresult_utf8 = zresult.decode("utf-8").strip()
myzlist = list(zresult_utf8)
print (myzlist[0])
zlistlen= len(myzlist)
zarray = list()
zlistlen -= 11
zi = 0
while( zi <zlistlen ):
        zarray.insert(zi, myzlist[zi])
        zi = zi + 1
zcombined = "".join(zarray)
zfmove = subprocess.call(["mv", zresult_utf8+".key",zcombined+".zsk.key"])
zfmove = subprocess.call(["mv", zresult_utf8+".private",zcombined+".zsk.private"])

#sfmove = subprocess.call(['dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k',zcombined+'.ksk.key','-o',dname,dname+'.external',zcombined+'.zsk.key'])
#cmd = "dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k','K'+dname+'.ksk.key','-o',dname,dname+'.external','K"+dname+'.zsk.key'
#subprocess.check_call(shlex.split(sfmove))

cmdargv = [ 'dnssec-signzone',
                  '-e'+strftime('%Y%m%d%H', gmtime())+'0000',
                  '-p',
                  '-t',
                  '-g',
                  '-k', zcombined+'.ksk.key',
                  '-o', dname,
                  dname+'.external',
                  zcombined+'.zsk.key'
]
print("command = %r" % (cmdargv,))
sfmove = subprocess.call(cmdargv)



also, is the % to Python what precision is to C++?





On Friday, February 20, 2015 at 6:30:51 PM UTC-5, Brad s wrote:
> # cat makekeys.py
> #!/usr/bin/python3.4
> import subprocess
> import sys
> import string
> import os.path
> import datetime
> import shlex
> from time import gmtime, strftime
> from subprocess import Popen, PIPE, STDOUT
> 
> pretime = strftime("%Y%m%d%H", gmtime())
> time = datetime.datetime.strptime(pretime,'%Y%m%d%H')
> print (time)
> plustime = datetime.timedelta(days=730)
> timeadd = (time + plustime)
> str(timeadd)
> #ndate = datetime.strptime(timeadd, '%Y%m%d%H')
> #timeadd = timeadd.replace(tzinfo=UTC())
> print (timeadd)
> 
> dname = input("Enter the domain to configure keys for? ")
> if os.path.exists(dname+".external.signed"):
>         os.remove(dname+".external.signed")
>         #os.remove(dname+".external")
>         os.remove(dname+".ksk.key")
>         os.remove(dname+".zsk.key")
>         os.remove(dname+".ksk.private")
>         os.remove(dname+".zsk.private")
> fd = open( dname+".external", 'w')
> fd.write("$TTL 86400\n")
> fd.write("$ORIGIN "+dname+".\n")
> fd.write("@  1D  IN SOA yoda.ex-mailer.com.  admin@"+dname+".(\n")
> fd.write("                      "+strftime("%Y%m%d%H", gmtime())+"\n")
> #fd.write("                     "+repr(timeadd)+"\n")
> fd.write("                      3h\n")
> fd.write("                      1h\n")
> fd.write("                      1w\n")
> fd.write("                      1h)\n")
> fd.write("                      IN NS   yoda.ex-mailer.com.\n")
> fd.write("                      IN NS   r2d2.ex-mailer.com.\n")
> fd.write(dname+".               IN TXT  v=spf1 mx a:r2d2.ex-mailer.com -all\n")
> fd.write(dname+".               MX 0    r2d2.ex-mailer.com.\n")
> fd.write("mail."+dname+".       IN A    107.191.60.48\n")
> fd.write("$include /usr/local/etc/namedb/K"+dname+".zsk.key ; ZSK\n")
> fd.write("$include /usr/local/etc/namedb/K"+dname+".ksk.key ; KSK\n")
> fd.close()
> 
> 
> result = subprocess.check_output(["dnssec-keygen", "-f", "KSK", "-r", "/dev/urandom", "-a", "RSASHA256", "-b", "2048", "-n", "ZONE", dname])
> result_utf8 = result.decode("utf-8").strip()
> mylist = list(result_utf8)
> print (mylist[0])
> listlen= len(mylist)
> array = list()
> listlen -= 11
> i = 0
> while( i < listlen ):
>         #if mylist != '\n' ^ mylist != '':
>         array.insert(i, mylist[i])
>         i = i + 1
> combined = "".join(array)
> print ('combined')
> print (combined)
> fmove = subprocess.call(["mv", result_utf8+".key",combined +".ksk.key"])
> fmove = subprocess.call(["mv", result_utf8+".private",combined +".ksk.private"])
> 
> zresult = subprocess.check_output(["dnssec-keygen","-r","/dev/urandom","-a","RSASHA256","-b","2048","-n","ZONE", dname])
> zresult_utf8 = zresult.decode("utf-8").strip()
> myzlist = list(zresult_utf8)
> print (myzlist[0])
> zlistlen= len(myzlist)
> zarray = list()
> zlistlen -= 11
> zi = 0
> while( zi <zlistlen ):
>         zarray.insert(zi, myzlist[zi])
>         zi = zi + 1
> zcombined = "".join(zarray)
> zfmove = subprocess.call(["mv", zresult_utf8+".key",zcombined+".zsk.key"])
> zfmove = subprocess.call(["mv", zresult_utf8+".private",zcombined+".zsk.private"])
> 
> sfmove = subprocess.call(['dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k',zcombined+'.ksk.key','-o',dname,dname+'.external',zcombined+'.zsk.key'])
> #cmd = "dnssec-signzone','-e',strftime('%Y%m%d%H', gmtime())+'0000','-p','-t','-g','-k','K'+dname+'.ksk.key','-o',dname,dname+'.external','K"+dname+'.zsk.key'
> #subprocess.check_call(shlex.split(cmd))
> 
> 
> 
> 
> 
> 
> # python3.4 makekeys.py
> 2015-02-20 23:00:00
> 2017-02-19 23:00:00
> Enter the domain to configure keys for? test123.com
> Generating key pair.........+++ ...............+++
> K
> combined
> Ktest123.com
> Generating key pair...+++ .........................................................+++
> K
> dnssec-signzone: fatal: No self-signed KSK DNSKEY found.  Supply an active
> key with the KSK flag set, or use '-P'.
> 
> I am trying to execute a subprocess, something done in my script a couple of times. But on the last one, it outputs an error I cannot find the solution to. The exact same command using the same files produced at the command line works just fine.
> 
> 
> 
> command works on the command line:
> 
> dnssec-signzone -e20180330000000 -p -t -g -k Ktest123.com.ksk.key -o test123.com test123.com.external Ktest123.com.zsk.key
> Verifying the zone using the following algorithms: RSASHA256.
> Zone fully signed:
> Algorithm: RSASHA256: KSKs: 1 active, 0 stand-by, 0 revoked
>                       ZSKs: 1 active, 0 stand-by, 0 revoked
> test123.com.external.signed
> Signatures generated:                        9
> Signatures retained:                         0
> Signatures dropped:                          0
> Signatures successfully verified:            0
> Signatures unsuccessfully verified:          0
> Signing time in seconds:                 0.010
> Signatures per second:                 875.401
> Runtime in seconds:                      0.013

[toc] | [prev] | [next] | [standalone]


#86067

FromLarry Hudson <orgnut@yahoo.com>
Date2015-02-21 12:33 -0800
Message-ID<Bcedncw3P7UBdnXJnZ2dnUU7-SGdnZ2d@giganews.com>
In reply to#86012
On 02/20/2015 08:47 PM, Brad s wrote:
[...]
> print("command = %r" % (cmdargv,))
> sfmove = subprocess.call(cmdargv)
>
>
>
> also, is the % to Python what precision is to C++?
>

No.  It is like the % in C's printf().

      -=- Larry -=-

[toc] | [prev] | [next] | [standalone]


#86013

FromBrad s <bcddd214@gmail.com>
Date2015-02-20 21:14 -0800
Message-ID<9edb2725-c91b-4ae2-b5f4-91a80ed3afe8@googlegroups.com>
In reply to#85996
Time adjustment error:

# python3.4 timefix.py
2015022105
2015-02-21 05:00:00
Traceback (most recent call last):
  File "timefix.py", line 15, in <module>
    ndate = datetime.datetime.strptime(timeadd, '%Y%m%d%H')
TypeError: must be str, not datetime.datetime



# cat timefix.py
#!/usr/bin/python3.4
import subprocess
import sys
from datetime import datetime
import datetime
from time import gmtime, strftime

pretime = strftime("%Y%m%d%H", gmtime())
time = datetime.datetime.strptime(pretime,'%Y%m%d%H')
print(pretime)
print (time)
plustime = datetime.timedelta(days=730)
timeadd = (time + plustime)
str(timeadd)
ndate = datetime.datetime.strptime(timeadd, '%Y%m%d%H')
#timeadd = timeadd.replace(tzinfo=UTC())
print (timeadd)
print (ndate)

[toc] | [prev] | [next] | [standalone]


#86020

FromCameron Simpson <cs@zip.com.au>
Date2015-02-21 17:47 +1100
Message-ID<mailman.18950.1424501263.18130.python-list@python.org>
In reply to#86013
On 20Feb2015 21:14, Brad s <bcddd214@gmail.com> wrote:
>Time adjustment error:
>
># python3.4 timefix.py
>2015022105
>2015-02-21 05:00:00
>Traceback (most recent call last):
>  File "timefix.py", line 15, in <module>
>    ndate = datetime.datetime.strptime(timeadd, '%Y%m%d%H')
>TypeError: must be str, not datetime.datetime
>
>
>
># cat timefix.py
>#!/usr/bin/python3.4
>import subprocess
>import sys
>from datetime import datetime
>import datetime
>from time import gmtime, strftime
>
>pretime = strftime("%Y%m%d%H", gmtime())
>time = datetime.datetime.strptime(pretime,'%Y%m%d%H')
>print(pretime)
>print (time)
>plustime = datetime.timedelta(days=730)
>timeadd = (time + plustime)
>str(timeadd)
>ndate = datetime.datetime.strptime(timeadd, '%Y%m%d%H')
>#timeadd = timeadd.replace(tzinfo=UTC())
>print (timeadd)
>print (ndate)

Well, timeadd is a date object, yes? strptime is for parsing a string for date 
information, but timeadd is already parsed, as it were. Why are you calling 
strptime at all?

Cheers,
Cameron Simpson <cs@zip.com.au>

stomping on roses and strangling kittens
    leaving no fingerprints cause we wear mittens
    inflatable prostitutes tied up with strings
    these are a few of my favorite things
        - gypsy <gypsy@popeet!c3.com>

[toc] | [prev] | [next] | [standalone]


#86018

FromBrad s <bcddd214@gmail.com>
Date2015-02-20 22:41 -0800
Message-ID<17160998-e376-438f-8410-4fb8fbe05718@googlegroups.com>
In reply to#85996
fixed with 

now = datetime.datetime.now()
later = now + datetime.timedelta(days=2*365)
striplater = later.strftime('%Y%m%d%H')




# python3.4 makekeys.py
Enter the domain to configure keys for? test1234.com
Generating key pair.......................................................................................................................................................................................+++ ......................................................................................................................................................................................+++
K
Generating key pair.....+++ .........................................................................+++
K
Verifying the zone using the following algorithms: RSASHA256.
Zone fully signed:
Algorithm: RSASHA256: KSKs: 1 active, 0 stand-by, 0 revoked
                      ZSKs: 1 active, 0 stand-by, 0 revoked
test1234.com.external.signed
Signatures generated:                        9
Signatures retained:                         0
Signatures dropped:                          0
Signatures successfully verified:            0
Signatures unsuccessfully verified:          0
Signing time in seconds:                 0.010
Signatures per second:                 883.392
Runtime in seconds:                      0.013

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web