i have script writing having unix/mac os in mind.
among other things, storing files on 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 coming unix, data_path has value
>>> data_path out[3]: '/data/cew/' interestingly, script still working under windows. files there 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, have no clue is. python saving these somewhere in user directory? naturally, folder doesnt exist. trying cd /data/cew gave me error in windows' cmd.
should c:/data/cew. have checked?
Comments
Post a Comment