0

Python 3.7.3 on AIX 7.1.0.0 import subprocess causes an error:

Traceback (most recent call last): File "main_iso_processing.py", line 3, in import subprocess File "", line 983, in _find_and_load File "", line 963, in _find_and_load_unlocked File "", line 906, in _find_spec File "", line 1280, in find_spec File "", line 1249, in _get_spec
File "", line 1213, in _path_importer_cache PermissionError: [Errno 13] Permission denied

I have removed or commented out everything except the print function and the import of subprocess. If I comment out import subprocess, it works. Also, I can import os or sys without getting the error.

#!/opt/bin/python3
import subprocess
print("starting...")

I would like to use subprocess to run some DataStage jobs.

NotWoz
  • 23
  • 6
  • Did my solution resolve your issue? Did you find a different solution? Just checking in. – Fletchy Aug 29 '19 at 21:03
  • @Fletchy1995, I appreciate the answer. Soemthing I don't understand is that the import of os or sys does not throw an error. What is different about the import of subprocess? – NotWoz Aug 30 '19 at 14:27
  • take a look at this link: https://stackoverflow.com/questions/39777345/subprocess-popen-oserror-errno-13-permission-denied-only-on-linux?rq=1 maybe this will help – Fletchy Aug 30 '19 at 18:18

1 Answers1

0

You're getting a permission denied error. Perhaps the directory of your python environment is only accessible as a super user. Try going to the directory of your python environment and changing permissions.

Linux, run this command:

$ sudo chown -R testuser:testuser /path/to/python

If you are unaware of your username type: whoami in the console and it will tell you.

Example for me:

$ whoami
>>> guest
$ sudo chown -R guest:guest /usr/bin/python3

Windows 10: Follow instructions at this link

Finally you may need to restart your computer for these changes to take effect.

Community
  • 1
  • 1
Fletchy
  • 311
  • 1
  • 4
  • 18
  • Verose logging has an interesting line - Python 3.7.3 (default, May 10 2019, 07:51:10) [C] on aix6 I wonder if the problem is that subprocesss is calling something like pipes or ps or something else on AIX, to which it doe not have permission. – NotWoz Aug 30 '19 at 18:42
  • Possibly, I'll be honest in saying I'm unsure. – Fletchy Aug 30 '19 at 20:15
  • Someone else is having/had the same problem: https://stackoverflow.com/questions/52746387/permission-denied-when-using-bash-command-in-python/57790093#57790093 I think it is an issue with permissions to the AIX pipe file(s), but am not sure. – NotWoz Sep 04 '19 at 14:01