flip selected line using python stand-alone window

541
5
11-02-2013 08:58 AM
HollyZhang1
New Contributor III
I am trying to flip selected pipelines using stand-alone python window. Below are the steps I used:

   1). line join attributes from other tables (MakeFeatureLayer, AddJoin);
   2). select lines based on the joined attributes (SelectLayerByAttribute);
   3). remove joins (RemoveJoin);
   4). flip line on the selected lines (FlipLine_edit with or without MakeFeatureLayer after the selection).

It is shown the same error:

ERROR 999999: Error executing function.
Workspace or data source is read only.
Workspace or data source is read only.
Failed to execute (FlipLine).

Anyone has any solution?

Thanks.
Tags (2)
0 Kudos
5 Replies
RichardFairhurst
MVP Honored Contributor
I am trying to flip selected pipelines using stand-alone python window. Below are the steps I used:

   1). line join attributes from other tables (MakeFeatureLayer, AddJoin);
   2). select lines based on the joined attributes (SelectLayerByAttribute);
   3). remove joins (RemoveJoin);
   4). flip line on the selected lines (FlipLine_edit with or without MakeFeatureLayer after the selection).

It is shown the same error:

ERROR 999999: Error executing function.
Workspace or data source is read only.
Workspace or data source is read only.
Failed to execute (FlipLine).

Anyone has any solution?

Thanks.


Can you post your actual script?  What is the line data source?  Is it SDE?  Is it a geometric network?  What license level do you have?  How many features are you trying to flip at one time?  I found it crashes if I try to flip too many at one time (more than about 10,000).  Did you use code like this for the flipline section?

import arcpy
try:
    arcpy.FlipLine_edit(inFeatures)
except Exception, e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "Line %i" % tb.tb_lineno
    print e.message
0 Kudos
HollyZhang1
New Contributor III
I am using the testing data in a file deodatabase. It is not a geometric network. The features are about 2000 to flip at one time. I use code exactly like this.
0 Kudos
RichardFairhurst
MVP Honored Contributor
I am using the testing data in a file deodatabase. It is not a geometric network. The features are about 2000 to flip at one time. I use code exactly like this.


Is the fc open in a  map?  Have you tried editing manually?  Are you sure you have access to the workspace you used?  Post your method of getting the fc into your code.
0 Kudos
HollyZhang1
New Contributor III
It does work good in ArcMap. I tried several times running the stand-alone python. They were all failure. Very lucky, I just got this time successful. Thanks.
0 Kudos
DarrenMcCormick
New Contributor
Holly:

In a Python script I can't seem to get FlipLine_edit to work on a selected set of lines contained within a shapefile. Unfortunately, all of the lines are getting flipped instead of just those that are selected.

Did you get FlipLine_edit to work through a Python script on a selected line or set of selected lines? If you were successful with this, could you post (with code) what you did?

Thanks!
0 Kudos