3

I have a .bat file that makes the following gsutil call to push a file to the Google Cloud:

python "C:\Program Files (x86)\gsutil\gsutil" -D -m cp -a public-read C:\Temp\MyMSI.msi gs://downloads-gs.mywebsite.com/binaries/myapplication/auto_installer/

Here is my output(with a few names changed for obscurity):

----------------------------------------------------------
Copy to google  11:02:33 AM 11:02:34 AM 00:00:00:479    Failed (Ignored)
Collapse    Messages    
Messages                
Collapse        
Executing external process: C:\Windows\system32\cmd.exe

Starting Directory: C:\BuildScripts
Parameters: /c "c:\buildscripts\push_goog.bat"
Collapse        
Output from C:\Windows\system32\cmd.exe

The system cannot find the drive specified.

C:\BuildScripts>pushd c:\BuildScripts\ 

The system cannot find the drive specified.
Traceback (most recent call last):
  File "C:\Program Files (x86)\gsutil\gsutil", line 67, in <module>
    from gslib.util import UsingCrcmodExtension
  File "C:\Program Files (x86)\gsutil\gslib\util.py", line 121, in <module>
    os.path.join(CreateTrackerDirIfNeeded(), '.last_software_update_check'))
  File "C:\Program Files (x86)\gsutil\gslib\util.py", line 108, in CreateTrackerDirIfNeeded
    os.makedirs(tracker_dir)
  File "C:\Python27\lib\os.py", line 150, in makedirs
    makedirs(head, mode)
**C:\BuildScripts>python "C:\Program Files (x86)\gsutil\gsutil" -D -m cp -a public-read C:\Temp\MyMSI.msi gs://downloads-gs.mywebsite.com/binaries/myapplication/auto_installer/**
  File "C:\Python27\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
WindowsError: [Error 3] The system cannot find the path specified: 'H:\\\\'
Program returned code  : 1

It is mentioning something about H:\\\\ which we don't use and never mentioned in the .bat file or in the params to gsutil. I'm not sure why it works perfectly when run from the FinalBuilder application and then it gets this error when the FinalBuilder website runs the same FinalBuilder application file but is just triggered through the FinalBuilder Server.

Any help would be great.

Brian T Hannan
  • 3,925
  • 18
  • 56
  • 96
  • Where is your home directory? We use [os.path.expanduser](http://docs.python.org/2/library/os.path.html#os.path.expanduser) to find it. Could it be set to H? – jterrace Nov 27 '13 at 16:34
  • I see! HOMEDRIVE is set to H: ... the problem is I think we need that set to that on that server machine for IT purposes. Any way around it? Can I hardcode it to tell where that dir instead of it trying to figure out? – Brian T Hannan Nov 27 '13 at 17:11

1 Answers1

3

The root cause for this is that your home directory is set to an invalid location.

As a workaround, you can change the tracker directory in your .boto configuration file. Here's the relevant section:

[GSUtil]
# 'resumable_tracker_dir' specifies the base location where resumable
# transfer tracker files are saved. By default they're in ~/.gsutil
#resumable_tracker_dir = <file path>

Uncomment the resumable_tracker_dir variable and set it to a location on disk that does exist.

jterrace
  • 64,866
  • 22
  • 157
  • 202
  • Where is the .boto config file located? – Brian T Hannan Nov 27 '13 at 18:25
  • 1
    It's normally in your home directory. When you ran gsutil config, it should have told you where it was placed. If you need to move it or run gsutil config again, you can set BOTO_CONFIG environment variable to move the location of the config. – jterrace Nov 27 '13 at 18:34
  • 1
    Ironically, it's usually in your home directory. Fortunately, though, you can specify where the .boto file is located by setting the BOTO_CONFIG environment variable. You can also set individual properties from the command line like so: "gsutil -m GSUtil:resumable_tracker_dir=SOME_VALID_PATH rest of command" – Brandon Yarbrough Nov 27 '13 at 18:35
  • Finally found the .boto file which was on the H:\ drive so I changed resumable_tracker_dir to be C:\BuildScripts\gsutil which I just created. However, I still get the exact same error. When it works it writes to the new dir. When it doesn't work it doesn't even get to that point of writing anything to that dir. – Brian T Hannan Nov 27 '13 at 19:33
  • The weird thing is when I run it from the FinalBuilder application (where it works, it shows it using the new resumable_tracker_dir) but when it fails from the FinalBuilder website it still shows that it can't find H:\\\\ .... and why the 4 slashes here? I still don't get that part. – Brian T Hannan Nov 27 '13 at 19:50
  • Do I need to put .gsutil stuff onto the C: drive altogether? How would I go about doing that? – Brian T Hannan Nov 27 '13 at 19:54
  • I figured it out ... had to move the .boto file to C:\BuildScripts then before I call gsutil I had to do a 'set HOME=C:\BuildScripts' ... I also changed the resumable_tracker_dir to C:\BuildScripts\gsutil ... this way everything works off the C: drive and not the H: drive. This allows IT to keep using the H: drive like they normally do for user directories and I can run my script in peace. Thanks everyone! – Brian T Hannan Nov 27 '13 at 20:16