Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns/node.py TypeError in to_text #3

Closed
yegle opened this issue Oct 18, 2011 · 2 comments
Closed

dns/node.py TypeError in to_text #3

yegle opened this issue Oct 18, 2011 · 2 comments

Comments

@yegle
Copy link

yegle commented Oct 18, 2011

zone.example file:
@ IN SOA dns.example.com. admin.example.com. (
2010042671 ; serial
3600 ; refresh
1200 ; retry
86400 ; expire
360 ; minimum
)
@ NS dns
test A 127.0.0.1

test.py

#!/usr/bin/python

import dns.zone, dns.name, dns.rdtypes

z = dns.zone.from_file('zone.example','example.com')
name = dns.name.from_text('test.example.com')
a = dns.rdtypes.IN.A.A(dns.rdataclass.IN, dns.rdatatype.A, '127.0.0.2')
z.replace_rdataset(name, a)
z.to_file('zone.output')

output:

Traceback (most recent call last):
File "./test.py", line 9, in
z.to_file('zone.output')
File "/usr/lib64/python2.7/site-packages/dns/zone.py", line 496, in to_file
relativize=relativize)
File "/usr/lib64/python2.7/site-packages/dns/node.py", line 52, in to_text
print >> s, rds.to_text(name, **kw)
TypeError: to_text() got multiple values for keyword argument 'origin'

@chuangbo
Copy link

second param of replace_rdataset must to be a rdataset:

a = dns.rdataset.from_text('in', 'a', 300, '127.0.0.2')

@rthalley
Copy link
Owner

Chuangbo's comment is the right fix for your code. I will, however, change dnspython so that the parameters to replace_rdataset() are typechecked, as it ought to raise an error when you do the wrong thing instead of failing mysteriously later.

/Bob

@rthalley rthalley closed this as completed Apr 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants