Hello,
I am using python 3.6.8 to make an XY Event layer. I first use the arcpy.MakeXYEventLayer_management(inputCSV, "Longitude", "Latitude", TempFeatureLayer, WGS84, "")
where TempFeatureLayer is defined earlier as "XYTemp", and WGS84 is the variable holding the GCS_WGS84 coordinate system info.
I pass this and get an error the first time that is pretty extensive but the end says: "
SystemError: <built-in function isinstance> returned a result with an error set"
I am able to continue running the code successfully inspite of this seeming error. I would like for this to simply not show up as the code will go to someone with little experience and i dont want this to trigger concern.
Interestingly when I run the code again for the next input, this error does not appear again....
Does anyone know of an exception handling i can use to eliminate this?
I am currently running 10.7 desktop and have been working in the jupityer notebooks version that comes with this desktop version.
i have attached the error and the python code i wrote. the section happens at line 277
Thank you for the help
Have you ever tried this geoprocess using ModelBuilder instead of pure python? I only say this because I have a geoprocess in ArcMap where an xy event layer is updated using a model every 5 minutes. I recall trying to export the model out to python but it never worked in a pure python envionment so I reverted it back to a model and it is still running. Just another option to try if this method does not work.
Thanks for the suggestion Michael. I have tried it in model builder and it works fine. Unfortunately the client has limited GIS and python capabilities so I was trying to create a method that would have limited user tinkering…which is of course less than ideal but…. The current script continues to run- it just generates an mass of errors that are rather alarming. The errors don’t stop or break the code though. I just wondered if there was a way I could write in an exception handle to hide them since they are more like alarms than errors. Which is weird to me.
Sophia
Have you tried just taking the try-except block out so that you get a 'failure' and the code stops?
Some reading
python - Why is "except: pass" a bad programming practice? - Stack Overflow
Originally she had it without the try except and the code ran fine; She was just trying to stop the errors from printing and possibly confusing the client.
How about running it in something other than a jupyter notebook? That would rule out a whole load of other issues
Dan,
That is an interesting idea- I believe I have done so…I have run it in ipython and in the python window thru ArcMap but both generate the same extensive error list…The only time I don’t get the error is when I run it at home in 10.8. But at work our servers are older and 10.8 and Pro 2.5 do not support them so the client will have to run them in 10.7 or Pro 2.4 until we get our servers upgraded.
I have been using the Jupyter notebook extension since arcpy was integrated. I am wondering your perspective on this per this comment- is the integration still fairly buggy? Do you have an alternative preference?
Thank you!
Sophia
So you don't have access to another Python IDE then?
Before I send you down that rabbit hole, sounds like you a running in a restricted environment and not in control of what you can use or do on your machine.
If you have some control, and do have an IDE other than jupyter, my suggestion was to try it to rule out issues. jupyter is fine...just not as fine as other python interfaces
My blog has loads of posts about Spyder (python IDE), cloning (for Pro) and the like. I wouldn't go there as a solution to your immediate problem however. It just sounds like you have to use what you have got and continue to serve-the-servers, rather than the other way around.