<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FileNameInsert.py in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39014#M3081</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan - I'm a tiny step closer to being a python expert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Jul 2014 11:06:08 GMT</pubDate>
    <dc:creator>BenLeslie1</dc:creator>
    <dc:date>2014-07-23T11:06:08Z</dc:date>
    <item>
      <title>FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39002#M3069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I downloaded this arcscript from here:&lt;A href="http://arcscripts.esri.com/details.asp?dbid=14534" title="http://arcscripts.esri.com/details.asp?dbid=14534"&gt;&amp;nbsp;&amp;nbsp; Filename Insert&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's an old script from 2006 and when I run it I get the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File "C:\FileNameInsert.py", line 15, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; import win32com.client, sys, string, os&lt;/P&gt;&lt;P&gt;ImportError: No module named win32com.client&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I modify this script so it works in 2014?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(what I hoping to achieve is to add a filename attribute to my shapefiles so that when I merge them together I can trace back to the originals)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 07:40:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39002#M3069</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T07:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39003#M3070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then replace gp. through arcpy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 07:45:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39003#M3070</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-07-23T07:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39004#M3071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - that kind of makes sence but the script isn't doing anything.&amp;nbsp; It runs without error but doesn't add the new field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you download the script?&amp;nbsp; Can I ask some questions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I removed line 17:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp = win32com.client.Dispatch...............&lt;/P&gt;&lt;P&gt;was I correct to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand the 'try:' section....it says:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs = arcpy.ListFeatureClasses("*", "all")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs.reset()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = fcs.Next()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why does it define fcs and then reset it on the next line?&amp;nbsp; What is it doing?&lt;/P&gt;&lt;P&gt;I'll be happy if you can recommend a place where I can read up on these terms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 08:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39004#M3071</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T08:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39005#M3072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;These two lines don't work in arcpy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs.reset()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = fcs.Next()&lt;/P&gt;&lt;P&gt;you might be advised to copy the script to your thread rather than relying on people downloading it themselves.&amp;nbsp; The translation from 9.x to 10.x isn't simply a matter of replacing gp with arcpy, there are other issues&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 08:54:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39005#M3072</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-23T08:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39006#M3073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good plan - my Arc machine isn't connected to the internet so usually it's a pain in the neck.&amp;nbsp; I forgot that I had downloaded the code off the internet.&lt;/P&gt;&lt;P&gt;This is the code after my changes........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#import relevant modules, create geoprocessing dispatch object&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#gp = win32com.client.Dispatch("esriGeoprocessing.gpDispatch.1")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Remember to change this to wherever your shapefiles are stored&lt;/P&gt;&lt;P&gt;arcpy.workspace = "C:\temp2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs = arcpy.ListFeatureClasses("*", "all")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs.reset()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = fcs.Next()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while fc:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create the new field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management (fc, "FILENAME", "text", "", "", "50")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Apply the filename to all entries&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management (fc, "FILENAME", '"' + fc + '"')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc = fcs.Next()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;except:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages ()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 09:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39006#M3073</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T09:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39007#M3074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On a quick look (can't test)&lt;/P&gt;&lt;P&gt;arcpy.workspace = "C:\temp2"&amp;nbsp;&amp;nbsp; #should be "C:/temp2&amp;nbsp; python uses forward slashes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # amongst other things, ie raw notation r"C:\temp2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #fcs = arcpy.ListFeatureClasses("*", "all")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs = arcpy.ListFeatureClasses()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #is all that is needed in your case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #fcs.reset()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #these two lines don't work in 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #fc = fcs.Next()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;remove one more fcs.Next line further down&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 09:10:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39007#M3074</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-23T09:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39008#M3075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What shoul I do to correct the while function, it still refers to fc.&lt;/P&gt;&lt;P&gt;I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IndentationError:unindent does not match any outer indentation level&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the .Next lines how does the code know to iterate through all by shapefiles?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry - I still need to be spoon fed this stuff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 09:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39008#M3075</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T09:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39009#M3076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;arrrgh need arcmap handy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace the while line with&lt;BR /&gt;for fc in fcs:&amp;nbsp;&amp;nbsp; #keep the proper indentation!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and your homework is to ensure that you have the appropriate syntax in&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000004m000000"&gt; CalculateField management &lt;/A&gt;in case it has changed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 09:33:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39009#M3076</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-23T09:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39010#M3077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Closer....closer....&lt;/P&gt;&lt;P&gt;I'm now getting some results but if I have several shapefiles in c:/temp2 the script only amends the last one (print fc lists all files correctly)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Remember to change this to wherever your shapefiles are stored&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = r"C:\temp2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fcs = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for fc in fcs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create the new field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management (fc, "FILENAME", "text", "", "", "50")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Apply the filename to all entries&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management (fc, "FILENAME", '"' + fc + '"')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;except:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages ()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 10:32:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39010#M3077</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T10:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39011#M3078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;again...not tested...try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;# Remember to change this to wherever your shapefiles are stored&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = r"C:\temp2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fcs = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;for fc in fcs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; print fc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Create the new field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; arcpy.AddField_management (fc, "FILENAME", "text", "", "", "50")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; # Apply the filename to all entries&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management (fc, "FILENAME", '"' + fc + '"')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print arcpy.GetMessages ()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There seems to be something with the try..except block&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 10:50:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39011#M3078</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-07-23T10:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39012#M3079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is better than rewriting?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14061130958049759 jive_text_macro" jivemacro_uid="_14061130958049759"&gt;
&lt;P&gt;# Import arcpy module&lt;/P&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Set Geoprocessing environments&lt;/P&gt;
&lt;P&gt;arcpy.env.workspace = "C:\\temp2"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;fcs = arcpy.ListFeatureClasses() &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;for fc in fcs:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Feld hinzufügen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "FILENAME", "TEXT", "", "", "100", "", "", "NON_REQUIRED", "")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Feld berechnen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(fc, "FILENAME", "fc", "PYTHON", "")&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 10:59:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39012#M3079</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-07-23T10:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39013#M3080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree - but it's not clear how you've done that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 11:04:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39013#M3080</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T11:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39014#M3081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan - I'm a tiny step closer to being a python expert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 11:06:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39014#M3081</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T11:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39015#M3082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haven't seen there was the solution &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It's quite easy, you use the model builder and export to script ....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 11:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39015#M3082</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-07-23T11:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39016#M3083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I didn't see you also corrected the script - I thought you were just saying your way of displaying the code in GeoNet was better.&amp;nbsp; It looks like a screenshot of Notepad++ but you can select the text?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm pretty new to Arc, I currently find ModelBuilder more confusing than code - I'm used to working with FME a lot so I want it to work like that, I find MB very unintuitive.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 11:17:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39016#M3083</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T11:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39017#M3084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's only a format option in GeoNet, you can define the code as python or other ....&lt;/P&gt;&lt;P&gt;Haven't used FME often, but don't u use there something similar to "model" geoprocessing tasks?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 11:48:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39017#M3084</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2014-07-23T11:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: FileNameInsert.py</title>
      <link>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39018#M3085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually I don't know why I mention it I think they are actually very different beasts and just because the flow diagram layout is similar I want to see ModelBuilder with my FME eyes.&amp;nbsp; And whereas FME is super flexible, user friendly and powerful, I have so far found modelbuilder to clunky, inflexible and unclear.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 12:36:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/filenameinsert-py/m-p/39018#M3085</guid>
      <dc:creator>BenLeslie1</dc:creator>
      <dc:date>2014-07-23T12:36:42Z</dc:date>
    </item>
  </channel>
</rss>

