I have written a python script to automatize some gsutil operations. gsutil works fine if I run it by command line. But if I translate the same command with subprocess in python I get an error:
BUCKET_NAME = 'datastore-backup'
FOLDER_NAME = 'my_folder'
gcs_path = os.path.join('gs://', BUCKET_NAME, FOLDER_NAME)
files = subprocess.check_output(['gsutil', 'ls', gcs_path], stderr=sys.stdout)
print(files)
I get this error
Traceback (most recent call last):
File "/Users/dario/Downloads/google-cloud-sdk/bin/bootstrapping/gsutil.py", line 13, in <module>
import bootstrapping
File "/Users/dario/Downloads/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 32, in <module>
import setup # pylint:disable=g-import-not-at-top
File "/Users/dario/Downloads/google-cloud-sdk/bin/bootstrapping/setup.py", line 55, in <module>
from googlecloudsdk.core import properties
File "/Users/dario/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 34, in <module>
from googlecloudsdk.core.util import times
File "/Users/dario/Downloads/google-cloud-sdk/lib/googlecloudsdk/core/util/times.py", line 55, in <module>
from dateutil.tz import _common as tz_common
ImportError: cannot import name _common
any help