Search code examples
pythonwinpdb

How to update plugins for SPE Python Editor


The default version of winpdb for SPE is v.1.3.4 that has problems to work with Python 2.7.

Here is what I have done to upgrade the version of winpdb to v.1.4.8

Step 1> Rename

C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup_spe\plugins\winpdb

as

C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup_spe\plugins\winpdb_v.1.3.4

Step 2> Download the winpdb v.1.4.8 and copy the folder as

C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup_spe\plugins\winpdb

Step 3> Load the winpdb v.1.4.8 directly without problems.

C:\Python27\python.exe "C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup_spe\plugins\winpdb\winpdb.py"

Step 4> Launch winpdb through SPE 0.8.4.c with the following errors

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> Traceback (most recent call last):   File "C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup\_spe\sm\wxp\NotebookCtrl.py", line 2722, in OnMouseMotion
    insidetab = self.GetInsideTab(pt)   File "C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup\_spe\sm\wxp\NotebookCtrl.py", line 2468, in GetInsideTab
    for tabs in self._tabrect: AttributeError: 'TabCtrl' object has no attribute '_tabrect' Traceback (most recent call last):   File "C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup\_spe\dialogs\winpdbDialog.py", line 144, in onDebug
    from plugins.winpdb import __file__ as fileName   File "C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup\_spe\plugins\winpdb\rpdb2.py", line 13488, in rpdb2_import_wrapper
    m = g_import(*args, **kwargs) ImportError: No module named winpdb

I have done the following things without solving the problem

1> Add the path

C:\Documents and Settings\daliu>set PYTHONPATH PYTHONPATH=C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup_spe\plugins\winpdb

2> Add the code

import sys
sys.path.append(r'C:\Program Files\SPE-0.8.4.c-wx2.6.1.0-no_setup\_spe\plugins\winpdb')

to rpdb2.py and winpdbDialog.py

Question 1> Why SPE can find the winpdb module in the old winpdb version?

Question 2> How to fix this problem?

Thank you


Solution

  • I followed your procedure and I got winpdb working.

    However after a closer look I realized that the working rpdb2 entity was not that on spe/plugins/winpdb but another installation in my site-packages.

    Maybe your problem is related with this. In your procedure you forgot to include the __init__.py file in the winpdb module. It does not come in the winpdb zip distribution file and it is needed to convert the folder into a package with modules that can be imported. You have more info about packages and module search here and here.

    So, just copy paste the __init__.py file from the old to the new folder (it is an empty file anyway).