一次成功调用后,使用wxPython重复调用ArcMap Python加载项失败 [英] Repeated calls to ArcMap Python Add-In with wxPython fail after one successful call

查看:116
本文介绍了一次成功调用后,使用wxPython重复调用ArcMap Python加载项失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个Python外接程序ArcGIS程序ArcMap,该程序使用wxPython包生成带有多个控件的wx.Frame窗口,其中包括关闭窗口的退出按钮。

I have written a Python Add-In for ArcGIS program ArcMap that uses the wxPython package to generate a wx.Frame window with multiple controls, including an Exit button that closes the window.

第一次运行外接程序时,它可以按预期工作,因此可以使用该按钮关闭wx.Frame窗口,而不会出现任何错误。但是,经过无数次运行外接程序后,我在再次运行外接程序时遇到致命错误。 (有时它在我第二次运行时失败。有时我可以在它失败之前多次运行。)错误窗口要求将报告发送到ESRI,但不幸的是,在这种情况下,ArcMap生成的唯一输出是.DMP。文件,我认为这只是一个内存转储。我不知道该怎么解释。

The Add-in works as intended the first time I run it, and I can close the wx.Frame window using the button without any errors. However, after a variable number of times running the Add-in, I get a fatal error on running the Add-In again. (Sometimes it fails the second time I run it. Sometimes I can run it multiple times before it fails.) The error window asks to send the report to ESRI, but unfortunately, the only output that ArcMap generates in this case is a .DMP file, which I assume is simply a memory dump. I don't know how to interpret it.

包装在加载项中的Python脚本可以通过ArcMap中的Python命令行正常运行(进行适当的修改) ,但是从ArcMap用户工具栏上的按钮运行它更为方便。

The Python script that is wrapped in the Add-In works fine from the Python command line in ArcMap (with suitable modifications), but running it from a button on an ArcMap user toolbar is more convenient.

有什么方法可以生成跟踪它遇到致命错误时发生的情况的跟踪信息。 ?失败时,没有错误消息发送到Python命令行窗口。

Is there any way to generate a trace of what exactly was happening when it encountered the fatal error? There is no error message sent to the Python command line window when it fails.

推荐答案

我能够找到答案问题来自ESRI GeoNet社区论坛上的帖子中的链接:

I was able to find an answer to this problem from a link in a posting on the ESRI GeoNet Community forum:

https://community.esri.com/thread/99532

(您需要登录论坛上的免费帐户才能请阅读帖子。)原始链接是Mark Cederholm在2010年ESRI开发者峰会上的演讲。该论坛帖子中的链接已过时,但我找到了另一个链接:

(You need to logon to a free account on the forum to read the postings.) The original link was to a presentation by Mark Cederholm at the ESRI Developer summit 2010. The link in the forum post was obsolete, but I found another link to it:

https://www.esri.com/videos/ watch?videoid = 1229& isLegacy = true

有效。该演示演示了如何构建一个ArcMap扩展,其中包含一个工具栏和一个在ArcMap启动时加载的按钮。而不是使用wx.Close()或wx.Destroy关闭窗口,它只是使用wx.Show(False)隐藏了它们。这种方法允许在对话框中使用wxPython GUI界面,这些对话框可以反复打开,关闭和重新打开,而不会导致ArcMap崩溃。

that worked. The presentation shows how to build an ArcMap Extension which contains a toolbar and a button that loads when ArcMap starts. Instead of using wx.Close() or wx.Destroy to close the windows, it simply hides them using wx.Show(False). This approach allows using wxPython GUI interfaces on dialog boxes that can be opened, closed, and reopened repeatedly without crashing ArcMap.

我认为这对于其他使用该功能的人很有用使用Python构建使用wxPython的ArcMap加载项。接下来,我将使用wxPython构建当前使用的另一个ArcMap外接程序(使用Visual Studio中的VB.NET编写的)转换为Python,以构建GUI界面。

I thought that this would be useful for other people using Python to build Add-Ins for ArcMap that make use of wxPython. Next, I will be converting another ArcMap Add-In that I currently use that was written in VB.NET in Visual Studio to Python using wxPython to build the GUI interface.

这篇关于一次成功调用后,使用wxPython重复调用ArcMap Python加载项失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆