I have a script that I was writing only having Unix/Mac OS in mind.
Among other things, it is storing files on a given folder
data_path = config.data_path
os.chdir(data_path)
testfile = urllib.URLopener()
try:
local_size = 0
remote_size = int(urllib.urlopen(remote_name).headers['Content-Length'])
if os.path.exists(data_path + temp_zip_name):
local_size = pathlib.Path(data_path + temp_zip_name).stat().st_size
if local_size != remote_size:
print 'downloading ' + temp_zip_name
testfile.retrieve(remote_name, temp_zip_name)
#local_size = pathlib.Path(data_path + filename).stat().st_size
else:
print 'skipping ' + temp_zip_name
Given that I was coming from UNIX, the data_path
has the value
>>> data_path
Out[3]: '/data/cew/'
Interestingly, the script still is working under windows. My files are there as expected:
>>> os.listdir('/data/cew')
Out[9]:
['2005.annual.singlefile.csv',
'2005.csv',
'2005.zip',
'2005_filtered.csv',
'2006.annual.singlefile.csv',
'2006.csv',
'2006.zip',
'2006_filtered.csv']
However, I have no clue where that is. Is Python saving these somewhere in my user directory? Naturally, this folder doesnt exist. Trying to cd /data/cew
gave me an error in Windows' cmd.