python console fails

229
6
11-05-2020 02:06 PM
New Contributor II

FYI, I did have a respectable early stage Geonet profile going, but had to abandon that profile in switch over to this account.  I am good with Python and am experienced in ArcMap (not yet Pro - thinking I should).

 

An major ESRI bug that I'm sick of working around:  Why does the Python console basically stop working randomly?  For instance, I start saving file paths, variables, mxd objects and running simple arcpy functions like:

arcpy.FeatureClassToFeatureClass(fp_in, fp_out, feat_name)

And nothing happens.  Python doesn't think, nothing processes, it just offers up a new line in the interpreter.  WHY!!! I have to restart the program, warm up all my directories again, all so I get arcpy related stuff to function for another hour or number of function calls and then it stops working again.

Another example in the same vein

mxd = arcpy.mapping.MapDocument("CURRENT")
# it runs almost instantly
# see what's there
mxd
# should say:
<MapDocument object at 0x1b6c6c30[0x1bc4fb40]>
#actually says:
RUNTIME ERROR

In both instances, the FeatureClassTo... and arcpy.mapping... it will work initially and for a bit.  And then just stop.  Like riding a bike and then the chain comes off the sprocket.  

It's killing my productivity and forcing me to undesirable GUI solutions or scripting for little stuff that should be in the console.

Any help, please!?

Zach

6 Replies
MVP Esteemed Contributor

When you say python console, do you mean the python window in ArcMap and/or ArcCatalog or the console window in your python ide?

can't wait to retire....
New Contributor II

ArcMap Python Console.  When the interpreter breaks like that, it won't even import packages.  For instance I type:

>>>import pandas      hit enter and a new line comes up immediately

>>>

However when I try typing:

>>>pandas.DataFrame(arg1, arg2, etc.)  I get

>>>RUNTIME ERROR

and checking

>>>dir()

no pandas, no mxd object in the first example, etc.  And I cannot diagnose what is causing it or determine how to fix it.  

ArcMap 10.6.1

MVP Esteemed Contributor

You might want to do a repair on your ArcGIS install.  I don't use ArcMap anymore, strictly Pro.  Where is your python install directory?

can't wait to retire....
New Contributor II

Thanks for the time Joe.  Hope this isn't a Googleable question, but how do I repair my install?  Definitely a separate question, but why do you prefer Pro?  I understand it's 64 bit and has good functionality (can't think of a better word) with ArcGIS Online.  It just seems to have all the same arcpy basics as ArcMap.  I realize that ArcMap is being phased out.  Just curious your perspective.  I do make a fair amount of maps and I script in Python a lot.  I also manage some ArcGIS Online content using the GIS Python API.  

I appreciate your help and hopefully perspective!

Zach

MVP Frequent Contributor

Windows start button,

Search  Add/Remove Programs

Select Remove

Select the option to "repair"


... sort of retired...
MVP Esteemed Contributor

I started making the transition to Pro about 2 years ago and will admit at first it was painful. I changed jobs in January and we are strictly a Pro shop. Now that I've  been with it for a while its second nature to me. As far as preference,  software is a tool to me, not a lifestyle.  I would rather move forward than hang on to the past.

can't wait to retire....