Copytree Question

299
2
Jump to solution
10-18-2016 06:38 AM
ChrisHolmes
Occasional Contributor III

Good day everyone,

I have a python script that:

  • creates a new folder using user input for part of the folder name
  • copies 6 files plus one file geodatabase into the folder
  • then opens up one of the mxd files

The following layers in the source file geodatabase have the following database locations:

  • layer: transnet_centerline_for_labeling:

  • layer: bridge_polygons:

In the python script I use copytree to copy the file geodatabase to the destination location:

Somehow the database location for these 2 layers is being changed in the file geodatabase when it is in the new location. For example:

  • layer: transnet_centerline_for_labeling:

  • layer: bridge_polygons:

Of course H:\geo_databases does not exist, so the layers display with red exclamation marks:

 

Does anybody have any idea why this path may be changing to a folder that doesn't exist. Is there something in how the database source path is defined that the layer is looking to what ever drive it happens to be mapped to? Although it's not just a difference of the drive letter, the change is from X:\GIS\geo_databases to H:\geo_databases.

Thanks for the help,

Chris

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

I will have to come back to this later, but it appears you have some layers with relative paths.  When the MXD gets copied to a new location, it is deriving a new path based on a relative path that was stored in the layer, but the new path doesn't exist.

View solution in original post

0 Kudos
2 Replies
JoshuaBixby
MVP Esteemed Contributor

I will have to come back to this later, but it appears you have some layers with relative paths.  When the MXD gets copied to a new location, it is deriving a new path based on a relative path that was stored in the layer, but the new path doesn't exist.

0 Kudos
ChrisHolmes
Occasional Contributor III

Thanks Joshua, I'll look into absolute pathing.

Chris

Sent from my iPhone

0 Kudos