well... I have been trying to use add-in to make simple button that had a date and current mxd name to features in the fcs in the gdb in use. still not working. I really don't understand how to use making addin.
I decided to give it a go using Arctoolbox as it looks simpler.
In first place with three input variables: date; file location (folder path); and file.
It works.
But I want to reduce the number of input variables. I was thinking to use 'current' and skip the file location and file manual input. The help on this says is that is not possible to use it in the background, therefore I made it run on foreground... however when I tried gave the following error.
I need some guidance on this because maybe it is impossible to use toolbox for this or maybe there is a workaround... anything.
cheers
P
Python errors:
Traceback Info:
File "\\eusc.europa.eu\ATLAS\Home\psoares\Documents\python\filesupporttools\uploadcurrentMXD_vectors_TOOLBOX_version.py", line 93, in <module>
issue_code = os.path.basename(mxdInicio)
Error Info:
<type 'exceptions.TypeError'>: object of type 'MapDocument' has no len()
GP errors:
line 93 code is the following:
<SPAN class="comment token"># mxd and environment; and gdb sources and targets</SPAN>
mxdInicio <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>MapDocument<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'current'</SPAN><SPAN class="punctuation token">)</SPAN>
mxdPath <SPAN class="operator token">=</SPAN> mxdInicio<SPAN class="punctuation token">.</SPAN>filePath
issue_code <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>basename<SPAN class="punctuation token">(</SPAN>mxdInicio<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">## line 93</SPAN>
issue_code <SPAN class="operator token">=</SPAN> issue_code<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">19</SPAN><SPAN class="punctuation token">]</SPAN>
issue_code <SPAN class="operator token">=</SPAN> issue_code<SPAN class="punctuation token">.</SPAN>replace<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"_"</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">" "</SPAN><SPAN class="punctuation token">)</SPAN>
mxdPathList <SPAN class="operator token">=</SPAN> mxdPath<SPAN class="punctuation token">.</SPAN>split<SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>sep<SPAN class="punctuation token">)</SPAN>
IssueGDB <SPAN class="operator token">=</SPAN> <SPAN class="string token">"\\"</SPAN><SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>mxdPathList<SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> IssueGDB<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>