POST
|
Does anyone have a solution to this? I really need to package up the maps and data for this project to share. The data is on AGOL.... Thanks
... View more
10-08-2020
11:43 AM
|
0
|
0
|
1177
|
POST
|
I just ran it again to get the error and of course it worked.... . I do however want to list all of the data on the drive and not just what is within a .gdb... So any suggestions how to edit this for that purpose?
... View more
05-30-2019
08:48 AM
|
0
|
2
|
1468
|
POST
|
I was just using that as the example, I'm trying to list data that is on an external drive (E:).
... View more
05-30-2019
08:37 AM
|
0
|
1
|
1468
|
POST
|
Thank you for that! #!/usr/bin/env python
print('Running script')
print('Importing libraries')
import arcpy
import os
### enter paths here
source = r'E:' #r is necessary because of backslashes
output = 'E:\listdata2019.txt' #alternatively you can use double backslashes instead.
###
arcpy.env.workspace = source # the specific functions being used in this script require the environment to be set to input database.
### defines different functions for use in reading the workspace
#gets source features for copy
def listFeaturesInGDB():
''' set your arcpy.env.workspace to a gdb before calling '''
for fds in arcpy.ListDatasets('','feature') + ['']:
for fc in arcpy.ListFeatureClasses('','',fds):
yield os.path.join(fds, fc)
#gets source tables for copy
def listTablesInGDB():
''' set your arcpy.env.workspace to a gdb before calling '''
for tbl in arcpy.ListTables('',''):
yield tbl
#gets source rasters for copy
def listRastersInGDB():
''' set your arcpy.env.workspace to a gdb before calling '''
for rstr in arcpy.ListRasters('',''):
yield rstr
print('Getting workspace items')
features = listFeaturesInGDB()
tables = listTablesInGDB()
rasters = listRastersInGDB()
#writes output to file
print('Writing to output file' + '\n')
out = open(output, 'w')
out.write('###FEATURES###' + '\n')
for f in features:
out.write(f + '\n') # the '\n' is a newline symbol
print(f)
out.write('\n' + '###TABLES###' + '\n')
for t in tables:
out.write(t + '\n')
print(t)
out.write('\n' + '###RASTERS###' + '\n')
for r in rasters:
out.write(r + '\n')
print(r)
out.close()
print('\nScript finished')
... View more
05-30-2019
08:36 AM
|
0
|
0
|
1468
|
POST
|
I am trying to run a script to list items out in a work space and I've used this script before except now I am getting errors. My experience with python is limited.... I did not create the script, so I have no clue what is happening. This is the error I keep receiving. Traceback (most recent call last): File "Source\Path", line 42, in <module> out = open(output, 'w') Here's a screen shot of the script. Any Ideas why it isn't working now? Thank you
... View more
05-29-2019
03:38 PM
|
0
|
9
|
1565
|
Online Status |
Offline
|
Date Last Visited |
07-20-2023
07:00 PM
|