I am stuck. I have python 2.7.16, ArcGIS Pro 2.7.1 and ArcMap 10.7.1 on the machine. I have a python script stand alone. It said it already run but then I have an error (0x2) with window task scheduler. I provided screenshots and one of pieces python script below. Please advise. I can provide more screenshots / info if needed.
It used to work but now I am not sure what is going on. It needs to be download zip file folder and extract it all from ArcGIS online to windows machine. It is actually working download zipped folder but it doesn't work to extract it all anymore.
UNDER ACTION TAB:
#1 START A PROGRAM:
Program/script:
C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\DownloadPAData.bat
#2 START A PROGRAM:
Program/script:
C:\Python27\ArcGISx6410.7\python.exe
Add arguments (optional):
C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test_Weekly_GDB_OpenData - Copy.py
# coding: utf-8
# In[5]:
from arcgis.gis import GIS
# Python Standard Library Modules
from pathlib import Path, PurePath
from zipfile import ZipFile
public_data_item_id = '123'
anon_gis = GIS(username="test", password="test")
data_item = anon_gis.content.get(public_data_item_id)
data_path = Path('C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test')
if not data_path.exists():
data_path.mkdir()
zip_path = data_path.joinpath('PAData.zip')
extract_path = data_path.joinpath('PADataDatasets')
data_item.download(save_path=data_path)
print (PurePath(zip_path))
Solved! Go to Solution.
path = 'C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test'
print(path)
C:\ArcGISETL\DataLoads est\WeeklyParcelPoly est
# ---- raw encoding.... little 'r'
path = r'C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test'
print(path)
C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test
path = 'C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test'
print(path)
C:\ArcGISETL\DataLoads est\WeeklyParcelPoly est
# ---- raw encoding.... little 'r'
path = r'C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test'
print(path)
C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test
I am a bit lost. Is this what you meant as below? Please correct me if I am wrong.
# coding: utf-8
# In[5]:
from arcgis.gis import GIS
# Python Standard Library Modules
from pathlib import Path, PurePath
from zipfile import ZipFile
public_data_item_id = '123'
anon_gis = GIS(username="test", password="test")
data_item = anon_gis.content.get(public_data_item_id)
data_path = Path = r('C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test')
if not data_path.exists():
data_path.mkdir()
zip_path = data_path.joinpath('PAData.zip')
extract_path = data_path.joinpath('PADataDatasets')
data_item.download(save_path=data_path)
print(path)
C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test
It has been fixed. Thank you @DanPatterson
I couldn't get past the path issue and it should be
r'C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\test'
with no ( )
did it error in your last incarnation?
It is fixed now and yes, it is working with (). Thank you @DanPatterson