arcpy.ImportToolbox crashing Python Command Prompt, but works in ArcGIS Pro (3.2.2) python window

229
1
Jump to solution
04-16-2024 02:28 PM
LMedeirosUI
Occasional Contributor

Hi All,

I'm new to python, but am trying to automate a simple model that works when not scheduled.

The model failed to run as scheduled and generated a crash log each time it tried. I have been getting a little bit of help from Drew Flater, who correctly identified my python install as being the issue (I think anyway). I've been trying to troubleshoot the issue a bit, but am at a loss.

I do know that the model runs without being scheduled. I also know that I am able to use the python window in ArcGIS Pro (v3.2.2) to run the model. However, when I use the Python Command Prompt (accessed from the ArcGIS Pro folder), the shell crashes/restarts after arcpy.ImportToolbox(r"path_to_toolbox"). I have tried AddToolbox and ListTools with the same result, but arcpy.GetInstallInfo() works. Attached is a jpg of the Python Command Prompt after I try to import the toolbox. As well as the model and toolbox.

It might be worth adding that when I first tried using the command prompt (arcpy.ImportToolbox("path", "test") [[I didn't have a model alias at first, but now do]], importing the toolbox did work, but when I tried to test the model (arcpy.test.model), the error was that the test module didn't exist. Now I can't even use the ImportToolbox command. Argh.

I have tried uninstalling and reinstalling ArcGIS Pro. I have no other version of Microsoft .NET installed (other than 6.0.5). I have tried the IDLE shell and it outputs "Shell Restarted". 

I am running Windows 11 Pro on Parallels Desktop 19 (MBPro 14", Apple Silicon M2 Max). The ArcGIS project I'm trying to use is in the C:\ directory of the virtual machine. ArcGIS installation files are installed in the C:\ directory, with the program folder in C:\Program Files.

If anyone has any suggestions on how to get this working, I'd really appreciate it! The model is simple, but having it automated means someone doesn't have to manually process the convert temporal data script a few times each day.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
LMedeirosUI
Occasional Contributor

It was something about my Windows install. I tried a lot of python fixes/work arounds, but nothing worked. Read one (old) thread that suggested Autodesk programs may have interfered with some DLLs. While removing Autodesk didn't seem to work (in the intended sense and also because Autodesk didn't want to uninstall...), I decided to start over fresh fresh.

I deleted my Windows 11 VM, reinstalled Windows 11, installed necessary software for ArcGIS Pro, then ArcGIS Pro. Worked.

No idea what messed things up, but I'm glad it's working and wanted to post what worked for me in case it happens to someone else.

View solution in original post

0 Kudos
1 Reply
LMedeirosUI
Occasional Contributor

It was something about my Windows install. I tried a lot of python fixes/work arounds, but nothing worked. Read one (old) thread that suggested Autodesk programs may have interfered with some DLLs. While removing Autodesk didn't seem to work (in the intended sense and also because Autodesk didn't want to uninstall...), I decided to start over fresh fresh.

I deleted my Windows 11 VM, reinstalled Windows 11, installed necessary software for ArcGIS Pro, then ArcGIS Pro. Worked.

No idea what messed things up, but I'm glad it's working and wanted to post what worked for me in case it happens to someone else.

0 Kudos