Subprocess "run" being used on Python2.7
becurrie opened this issue · 1 comments
becurrie commented
When attempting to use the create_database_dump
utility on a legacy python2.7 system, the subprocess command fails because run
doesn't exist in the subprocess module bundled with Python 2.7.
https://docs.python.org/3.5/library/subprocess.html#older-high-level-api
I believe the equivalent is call
instead of run
.
Relevant traceback:
Traceback (most recent call last):
File "/Users/brett/.virtualenvs/iris/bin/pganonymize", line 8, in <module>
sys.exit(main())
File "/Users/brett/.virtualenvs/iris/lib/python2.7/site-packages/pganonymizer/__main__.py", line 12, in main
main(args)
File "/Users/brett/.virtualenvs/iris/lib/python2.7/site-packages/pganonymizer/cli.py", line 89, in main
create_database_dump(args.dump_file, pg_args)
File "/Users/brett/.virtualenvs/iris/lib/python2.7/site-packages/pganonymizer/utils.py", line 274, in create_database_dump
subprocess.run(cmd, shell=True)
AttributeError: 'module' object has no attribute 'run'
hkage commented
Yes, call
should be available for Python 2.7. I will fix this and will release it with the upcoming version 0.7.0. I also added a regression test that will at least verify that subprocess.call
will be called by the create_database_dump
function.
Thanks for reporting!