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

Subprocess "run" being used on Python2.7 #34

Closed
becurrie opened this issue Nov 23, 2021 · 1 comment
Closed

Subprocess "run" being used on Python2.7 #34

becurrie opened this issue Nov 23, 2021 · 1 comment

Comments

@becurrie
Copy link

becurrie commented Nov 23, 2021

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
Copy link
Contributor

hkage commented Nov 30, 2021

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!

hkage added a commit that referenced this issue Nov 30, 2021
#34: Use `subprocess.call` to support Python 2.7
@hkage hkage closed this as completed Nov 30, 2021
hkage added a commit that referenced this issue Nov 30, 2021
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

2 participants