-
Notifications
You must be signed in to change notification settings - Fork 330
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
Cannot execute a sequential gsutil in windows batch file #233
Comments
Hi - did the first command exit with a non-0 exit status? That would cause the batch file to abort. |
I've tested like below: a.exe below is the result: C:\Temp>test.bat C:\Temp>a.exe C:\Temp>echo Exit Code is 0 C:\Temp>gsutil cp -R a gs://zelon-test/ C:\Temp> First echo command is executed and show the return value of a.exe. But second echo command(after first gsutil command) is not executed. It seems that gsutil kill the windows batch process. |
I just tried running the following script on Windows 7 Ultimate with Service Pack 1, and it worked for me: \Python27\python.exe \cygwin\usr\local\bin\gsutil\gsutil cp c:\try.bat gs://my-bucket/1 What version of Windows are you runing? Mike |
I've address this issue with your advice. Thank you.I'm using Windows 8.1 Pro K(Korean) and default python version is 2.7.6 64 bit Uploading gs://zelon-test/a.exe: 14 KB/14 KB So I used "gcloud auth login" and I can use test.bat correctly for now. |
With short form like "gsutil", I still cannot use that test.bat. With full path like "C:\Python27\python.exe E:\Programs\google-cloud-sdk\platform\gsutil\gsutil.py" I can use that test.bat |
Hi - I've never been able to get gsutil to work on Windows without fully specified paths - that's how we recommend you use gsutil on Windows (see the Windows tabs of the various pieces of documentation at https://cloud.google.com/storage/docs/gsutil_install). I'm closing this issue because it's working as documented. I'm glad you were able to get things working. |
Thanks. This has helped me too. |
I just stumbled upon this problem myself (I run several gcloud commands to transfer data periodically). In your batch file be sure to preface
Using |
THAT is the answer! Thank you Marty! "There always seems to be a way to fix things." - MacGyver |
Indeed, thanks Marty, I didn't know about that either. |
i have the same exact problem but when i use the full paths, i am using the paths: "C:\Python27\python.exe" "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\gsutil\gsutil.py" cp %myfile.txt% gs://%myBucket%/%folder%/ getting the exception: ServiceException: 401 Anonymous caller does not have storage.objects.create access to %myBucket%/%folder%/%myfile.txt% this does not happen when i use the gsutil comand, Any recomendation? |
UPDATE: i manage to work around the problem creating a new process for every operation as child's of the original batch file process using the call comand. therefore the comands inside the batch files now look something like this: ** call cmd /c gsutil cp %file_1% gs://%bucket%/%folder%/ ** note that the /c allows the original batch process to wait for the other sub-process so all the operation looks just as it should be |
I'm using gsutil to backup my datas in windows. And my batch file is like below:
gsutil cp -R a gs://zelon-test/
gsutil cp -R b gs://zelon-test/
But only the first command "gsutil cp -R a gs://zelon-test/" is executed. Second command is not executed at all.
The text was updated successfully, but these errors were encountered: