Select to view content in your preferred language

Window Task Scheduler Error with Python Script

3174
5
Jump to solution
03-14-2021 05:33 PM
AlexP_
by
Frequent Contributor

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. 

AlexP__6-1615767655481.png

AlexP__1-1615766585743.png

 

AlexP__0-1615766263927.png

AlexP__2-1615766767138.png

UNDER ACTION TAB:

#1 START A PROGRAM:

Program/script:

C:\ArcGISETL\DataLoads\test\WeeklyParcelPoly\DownloadPAData.bat

AlexP__4-1615766996665.png

#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

AlexP__5-1615767060456.png

AlexP__7-1615768042000.png

AlexP__8-1615768121660.png

AlexP__6-1615767655481.png

 

# 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))

 

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor
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

... sort of retired...

View solution in original post

5 Replies
DanPatterson
MVP Esteemed Contributor
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

... sort of retired...
AlexP_
by
Frequent Contributor

 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

 

 

 

0 Kudos
AlexP_
by
Frequent Contributor

It has been fixed. Thank you @DanPatterson 

0 Kudos
DanPatterson
MVP Esteemed Contributor

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? 


... sort of retired...
0 Kudos
AlexP_
by
Frequent Contributor

It is fixed now and yes, it is working with (). Thank  you @DanPatterson 

0 Kudos