|
POST
|
Just for a test, I created a simple python script (below) that calls some basic arcpy functions to see whether or not it's arcpy in general or some specific functions that are causing an issue. The script below will output a .txt file to a user's desktop showing whether or not a sample feature class exists and if it does, some basic describe properties. I was able to execute this script using python 3.5 that comes with ArcGIS Pro and setting Task Scheduler to 'Run whether user is logged on or not' ... so, it may be the actual layout exporting functions that are an issue. # import modules
import os
userDesktop = os.path.join(os.path.expanduser('~'), 'Desktop')
testFc = r'...path to fc...'
def test_arcpy(output_log_folder, test_fc_path):
log_path = os.path.join(output_log_folder, 'arcpyTest.txt')
f = open(log_path, 'w')
import arcpy
f.write('Successfully imported arcpy...\n')
# try testing if fc exists
if arcpy.Exists(test_fc_path):
f.write('{0} exists...\n'.format(test_fc_path))
# try testing some describe functions
desc = arcpy.Describe(test_fc_path)
data_type = desc.dataType
shp_type = desc.shapeType
oid_fld = desc.OIDFieldName
sr = desc.spatialReference.name
f.write(' Data Type: {0}\n'.format(data_type))
f.write(' Shape Type: {0}\n'.format(shp_type))
f.write(' OID Field: {0}\n'.format(oid_fld))
f.write(' Spatial Reference: {0}\n'.format(sr))
else:
f.write('{0} does not exist...'.format(test_fc_path))
f.close()
# test arcpy functions
test_arcpy(userDesktop, testFc)
... View more
06-29-2017
11:53 AM
|
0
|
1
|
4337
|
|
POST
|
I would second that it points to python 3.5. I'm using the same username on the same server to execute both 2.7 and 3.5 scripts. My 2.7 scripts have no issue running when set to 'Run whether user is logged on or not'.
... View more
06-29-2017
10:58 AM
|
0
|
3
|
4337
|
|
POST
|
I agree that somewhere a specific (or all) arcpy function(s) seems to be an issue. If I comment out all the functions that use arcpy and re-run my script, it executes fine with 'Run whether user is logged on or not'. The script will successfully create a log (.txt file) and send an email when complete.
... View more
06-29-2017
10:43 AM
|
1
|
0
|
4526
|
|
POST
|
I am using ArcGIS Pro 2.0 (Single Use Advanced)...and after reading through the thread, my script will work ONLY when the task is set to 'Run only when user is logged on'. If I try to execute the script using 'Run whether user is logged on or not' it will fail. Thanks for pointing me in the direction of the other thread.
... View more
06-29-2017
10:35 AM
|
1
|
6
|
6784
|
|
POST
|
I was pointed to this thread because I'm having a similar issue. I have a python script that is exporting PDFs from an ArcGIS Pro project. The script works as expected using an IDE (PyCharm) but when I try to migrate it to task scheduler, it will ONLY work when I have 'Run only when user is logged on'. If I change this property to 'Run whether user is logged on or not' it will fail. The system environment the script is being run on: OS: Windows Server 2012 R2 Pro Version: ArcGIS Pro 2.0 Pro License Type: Single Use Advanced Python exe: ..\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe So...if I'm reading the thread above correctly...starting at Pro 2.0 you should be able to export out documents (PDF, PNG, JPG, etc...) from a layout...which again, I can confirm is doable, but ONLY if the task is set to 'Run only when user is logged on'. Is there no way to execute this when the user is not logged on?
... View more
06-29-2017
10:33 AM
|
0
|
11
|
4526
|
|
POST
|
I am in the process of migrating a scheduled task from ArcMap to ArcGIS Pro that exports maps to PDFs on a daily basis. I have the python script written, and it executes as expected when running through an IDE (PyCharm) using the python executable delivered with ArcGIS Pro (..\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe). When I try executing the same script through Windows Task Scheduler, I can tell the script is running because a .txt file is generated to log processes, however, at some point the script is failing as the maps are not being exported. The task scheduler returns a code of 0xFFFFFFFF and I haven't found anything of substance for this code. There are no warnings or errors in the task history either to give any clues. We have several other tasks that are running just fine using python 2.7 along with ArcMap/ArcGIS Desktop using my domain account, so the username I'm using has sufficient permissions to execute a task. I also have ArcGIS Pro setup to login automatically, which again, works fine through the IDE. I tried using a Single Use license, with the same result. If I comment out all the ArcGIS Pro / arcpy functions, the script will execute as expected through Task Scheduler (creates a log, and sends an email). It seems to be specific to the arcpy functions. Is anyone running a Windows Task Scheduler task using ArcGIS Pro projects successfully? If so, am I missing something? Is there some sort of permission setting I'm missing? Any ideas of where to look...?
... View more
06-29-2017
09:33 AM
|
1
|
11
|
10747
|
|
POST
|
I checked one of the triggers I'm using and noticed a slight variance than the above screenshot...which I probably noticed after trying to edit features! The sample below should take care of handling features were a sequence has already been applied. The add (a) delta table for this test feature class has the trigger below applied to it, which is set to update the ID field on an insert/create IF the ID field is NULL. You can see on subsequent edits of the feature, the 'ID' field remains the same value because the field is not NULL, and thus the trigger is skipped. Modified trigger to account for already-populated sequence value. The 'IF' statement on line 27 will check the inserted table to see if the sequence field (ID in this example) is already populated. If it's not, the next value within the sequence will be grabbed and populated into the 'ID' field as shown on line 35. I blocked out our database and schema name. Simply replace with your values. Add (a) delta table showing edits. ID field remains as-is on subsequent edits because it is already populated.
... View more
06-28-2017
12:41 PM
|
3
|
4
|
4306
|
|
POST
|
Yea...I've looked through the classes. I would think it'd be a method within the layouts, but I don't see anything. Was hoping someone else had already dove into this, and I was missing it somewhere.
... View more
06-23-2017
02:19 PM
|
0
|
0
|
4460
|
|
POST
|
I've seen these pages, however I don't see any documentation or sample python docs for how to use python to iterate over a map series and export the pages within a series. That's what I'm looking for, whether or not this is possible with ArcGIS Pro.
... View more
06-23-2017
01:20 PM
|
0
|
2
|
4460
|
|
POST
|
I was able to add in content source folders for my project, and when running sys.path, it returns the folders that are shown within ArcGIS Pro (screenshot below), but I am still getting an error that a module can't be found. sys.path error message with importing arcpy
... View more
06-23-2017
09:51 AM
|
0
|
0
|
3022
|
|
POST
|
I'm not running on a machine that has Server installed.
... View more
06-23-2017
09:12 AM
|
0
|
0
|
3022
|
|
POST
|
I'm by far an expert when it comes to Python...so, I generally use PyCharm when it comes to writing scripts as I find it to be a great IDE for Python. I'm starting the process of moving some of my 2.7.x scripts to 3.5.x for use with ArcGIS Pro. I have configured PyCharm to use the python interpreter packaged with ArcGIS Pro 1.4.1, located at the following: C:\Program Files\ArcGIS\Pro\bin\Python. However, arcpy is not recognized as an available module. If I run sys.path from within PyCharm, I get the following paths: If I run sys.path from within ArcGIS Pro, I get the following paths: What do I need to do in order to get PyCharm to be able to use arcpy? Do I need to add system environmental variable paths? If so, from the list returned in ArcGIS Pro, how many need to be added? Is there some other way of getting the arcpy module to be recognized within PyCharm? Is there a best practice that is used with python? Thanks!
... View more
06-23-2017
08:30 AM
|
0
|
7
|
5719
|
|
POST
|
I'm considering moving some of my map production projects to ArcGIS Pro, but most of them rely on data driven pages and python scripts to automatically iterate over the pages and export out PDFs. I have looked through the arcpy.mp module and don't see any method, class, or function for accessing map series properties...maybe I'm missing it...? Without having the ability to script and export a map series, I'm kind of wondering why this is even a part of ArcGIS Pro...? Is there going to be future development in ArcGIS Pro that will provide the capability of iterating over map series pages and use the already existing exportToPDF, exportToJPEG, exportToPNG, etc...?
... View more
06-23-2017
06:42 AM
|
0
|
22
|
15908
|
|
POST
|
Thanks for the thorough reply! What I gather from that is, it's best-form to update the CA certificate within ArcGIS Server. Having said that, is it best to delete the CA certificate and import the new one, or can we use the 'importSignedCertificate' operation on our existing CA certificate within Server admin...or does it really matter which way we do it?
... View more
05-24-2017
10:13 AM
|
0
|
1
|
11325
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | a week ago | |
| 1 | a week ago | |
| 3 | a week ago | |
| 15 | a week ago | |
| 5 | a week ago |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|