sdgathman / pyspf

Other
49 stars 26 forks source link

[Python3] SyntaxError at pydns.py #6

Closed csuka closed 5 years ago

csuka commented 6 years ago
➜  pyspf git:(master) ✗ python3 spf.py 1.2.3.4
Traceback (most recent call last):
  File "spf.py", line 95, in DNSLookup
    from SPF.pydns import DNSLookup
  File "/path/pyspf/SPF/pydns.py", line 28
    raise spf.TempError, 'DNS: TCP Fallback error: ' + str(x)
                       ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "spf.py", line 1886, in <module>
    print(q.dns_spf(argv[0]))
  File "spf.py", line 1086, in dns_spf
    a = [t for t in self.dns_txt(domain) if RE_SPF.match(t)]
  File "spf.py", line 1135, in dns_txt
    dns_list = self.dns(domainname, rr,ignore_void=ignore_void)
  File "spf.py", line 1266, in dns
    for k, v in DNSLookup(name, qtype, self.strict, timeout):
  File "spf.py", line 97, in DNSLookup
    from SPF.dnspython import DNSLookup
  File "/path/pyspf/SPF/dnspython.py", line 27
    except dns.exception.DNSException,x:
                                     ^
SyntaxError: invalid syntax

Changed: raise spf.AmbiguityWarning, 'DNS: Truncated UDP Reply, SPF records should fit in a UDP packet, retrying TCP'

To raise spf.AmbiguityWarning('DNS: Truncated UDP Reply, SPF records should fit in a UDP packet, retrying TCP')

To make it work on python3 on my setup.

neonknight commented 5 years ago

I submitted pull request #9 which should fix this issue

sdgathman commented 5 years ago

The real issue here is that the true "master" branch is pyspf-2_0-branch. This is an artifact of converting from CVS. I apologize for being such a git newbie, but I still haven't managed to get the branches renamed. I did make a pyspf-2.1 branch that was a copy of master - but I'm not sure what the next step is. I guess I should make a note of the situation in the README on the current "master".

neonknight commented 5 years ago

OK, I didn't notice that. Thanks for clarification. maybe the best way to fix this is to merge pyspf-2_0 into master, getting the master branch updated with all patches/commits included in pyspf-2_0

git checkout master
git pull origin master
git merge pyspf-2_0
git push origin master

might be a way to do it...

sdgathman commented 5 years ago

I tried that. Notice the "merge pyspy-2_0-branch into master" commit - but I managed to screw it up. Fortunately, I saved master beforehand as the pyspf-2.1 branch.

I think the issue is doing a merge instead of "make this exactly like pyspf-2_0-branch".

Based on my newbie understanding of git, I would think I should be able to rename branches as well.