mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Fixing compile time errors irt (, e => as e, print(), ocat now 0o not 0) exception handling for Python 3 (#3851)
* Fixing compile time errors irt a) exception handling for Python 3 in util, also: b) problem octal usage (fixed) and c) print json_dump -> print(json_dump(xyz) ... et al * This code was not Python 2.4 compliant. Octal codes and exception handling is now working with Py 2.4, 2.6, & 3.5. * Fixing formating (or rather reverting an non 2.4 compatible change). Works in compile & runtime checking. * a) revert to use print sys.stderr not fail_json; b) fixed var name in exception * Python 3 compatible print (print >>sys.stderr will generate a TypeError - now uses sys.stderr.write instead).
This commit is contained in:
parent
82436d5519
commit
c901b70a01
2 changed files with 21 additions and 17 deletions
|
@ -79,7 +79,7 @@ def main():
|
|||
data = file(log_path).read()
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
if data == '':
|
||||
# file not written yet? That means it is running
|
||||
module.exit_json(results_file=log_path, ansible_job_id=jid, started=1, finished=0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue