had to delete
Of course, skipping the try except block reveals the same message.
Only use them if you know you are going to get an error message that would be thrown that isn't a python error or you want to do something else if there is an error.
foo <SPAN class="operator token">=</SPAN> <SPAN class="string token">'a'</SPAN> bar <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN> concat <SPAN class="operator token">=</SPAN> foo <SPAN class="operator token">+</SPAN> bar Traceback <SPAN class="punctuation token">(</SPAN>most recent call last<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN> File <SPAN class="string token">"<ipython-input-56-ef8dcb5742bb>"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">1</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="operator token"><</SPAN>module<SPAN class="operator token">></SPAN> concat <SPAN class="operator token">=</SPAN> foo <SPAN class="operator token">+</SPAN> bar TypeError<SPAN class="punctuation token">:</SPAN> must be str<SPAN class="punctuation token">,</SPAN> <SPAN class="operator token">not</SPAN> int<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>
a better non-fail
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN> concat <SPAN class="operator token">=</SPAN> foo <SPAN class="operator token">+</SPAN> bar <SPAN class="keyword token">except</SPAN><SPAN class="punctuation token">:</SPAN> concat <SPAN class="operator token">=</SPAN> <SPAN class="string token">"{}{}"</SPAN><SPAN class="punctuation token">.</SPAN>format<SPAN class="punctuation token">(</SPAN>foo<SPAN class="punctuation token">,</SPAN> bar<SPAN class="punctuation token">)</SPAN> concat <SPAN class="string token">'a1'</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Unless you specifically ask for the exception, the error message won't be displayed - that's the point of try/except:
foo <SPAN class="operator token">=</SPAN> <SPAN class="string token">'a'</SPAN> bar <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN> <SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN> concat <SPAN class="operator token">=</SPAN> foo <SPAN class="operator token">+</SPAN> bar <SPAN class="keyword token">except</SPAN> Exception <SPAN class="keyword token">as</SPAN> e<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>e<SPAN class="punctuation token">)</SPAN> must be str<SPAN class="punctuation token">,</SPAN> <SPAN class="operator token">not</SPAN> int<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Of course, you may have this, but we can't see your try/except statement.
Umm ok I added a try. Not sure why that matters. I cant post all 300 lines.
Really just asking if anyone has gotten a blank error on Append.
thanks
You state the "tool trips the try statement," but I don't see any try statement in what you posted. If the code you posted is the working code, then I suggest you post the code that generates the error if it is the error you are trying to get feedback on.
yea just a part of the code - its 300 lines...
Yes the error is blank - that was the whole point of my post. It works yet fails with error text of ''.
Did your code get cut off? For one, I don't see a try statement anywhere in what you posted. Also, there is no text below "Error is".
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.