Reputation: 23
I tried to take text from one field and set it modificated to another throught Execute Python Code.
recs = record.smt
for rec in recs:
details = pythonwhois.get_whois(rec)
if 'No match for' in str(details):
record.smt2='ok'
else:
record.smt2='denied'
Error: forbidden opcode
Please, help!
Upvotes: 2
Views: 2131
Reputation: 2825
For the line:
details = pythonwhois.get_whois(rec)
You are using a external library pythonwhois
which is not imported, how do you suppose to use that in your execution. As import
statement is also not allowed, you can't just import any library.
instead of using dot operator, try to use write
function.
if 'No match for' in str(details):
smt2='ok'
else:
smt2='denied'
record.write({'smt2': smt})
Also keep in mind that record
is the record on which the action is triggered; may be void
Upvotes: 2