FAQ

??? wrote:
I found one small bugs in PyGUI when I run blobedit.py under python 3.2:

File "C:\Python32\lib\site-packages\GUI\GStdMenus.py", line 82
include = include + sum(always_include)
^
TabError: inconsistent use of tabs and spaces in indentation

*Fix:*
Replace line 81 in C:\Python32\lib\site-packages\GUI\GStdMenus.py:

#include = include + sum(always_include)
include = include.intersection(sum(always_include))
I don't understand this. There doesn't seem to be anything wrong with
the indentation around that line in my source, and even if there was,
I don't see how the change you suggest would fix it, except by the
side effect of changing the whitespace.

Is this a bug in Python 3.2? Has anyone else seen this? I don't have
a 3.2 installation at hand to test it on, and I'm reluctant to change
anything until I understand what's going on better.

--
Greg

Search Discussions

  • David Robinow at Jan 22, 2012 at 4:30 am

    On Sat, Jan 21, 2012 at 6:56 PM, Greg Ewing wrote:
    ??? wrote:
    I found one small bugs in PyGUI when I run blobedit.py under python 3.2:

    ?File "C:\Python32\lib\site-packages\GUI\GStdMenus.py", line 82
    ? ?include = include + sum(always_include)
    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
    TabError: inconsistent use of tabs and spaces in indentation

    *Fix:*
    Replace line 81 in C:\Python32\lib\site-packages\GUI\GStdMenus.py:

    ? ?#include = include + sum(always_include)
    ? ?include = include.intersection(sum(always_include))

    I don't understand this. There doesn't seem to be anything wrong with
    the indentation around that line in my source, and even if there was,
    I don't see how the change you suggest would fix it, except by the
    side effect of changing the whitespace.

    Is this a bug in Python 3.2? Has anyone else seen this? I don't have
    a 3.2 installation at hand to test it on, and I'm reluctant to change
    anything until I understand what's going on better.

    --
    Greg
    I think the OP must have caused an indentation error trying to fix the bug.
    I get the following (Vista PyGUI-2.5.3 Python3.2.2)
    Traceback (most recent call last):
    File "blobedit.py", line 132, in <module>
    BlobApp().run()
    File "c:\python32\lib\site-packages\GUI\GApplications.py", line 144, in run
    self.menus = basic_menus()
    File "c:\python32\lib\site-packages\GUI\StdMenus.py", line 53, in basic_menus
    exclude = exclude)
    File "c:\python32\lib\site-packages\GUI\GStdMenus.py", line 81,in build_menus
    include = include + sum(always_include)
    TypeError: unsupported operand type(s) for +: 'set' and 'set'

    The demo runs with the proposed fix but it also runs using "union"
    rather than "intersection" which seems more appropriate for the '+'
    operator. But I don't really understand the code very well. Probably
    the correct solution is to make '+' work.
    I haven't tried any fix on Python 2.
  • 馬吉軍 at Jan 22, 2012 at 5:56 am
    Hi,

    Sorry that I copied wrong error message. The error in my previous mail is
    caused when I'm fixing the code.
    Original error is this:

    Traceback (most recent call last):
    File "C:\Users\CNKIMA\workspace\PyCAN\blobedit.py", line 132, in <module>
    BlobApp().run()
    File "C:\Python32\lib\site-packages\GUI\GApplications.py", line 144, in
    run
    self.menus = basic_menus()
    File "C:\Python32\lib\site-packages\GUI\StdMenus.py", line 53, in
    basic_menus
    exclude = exclude)
    File "C:\Python32\lib\site-packages\GUI\GStdMenus.py", line 81, in
    build_menus

    include = include + sum(always_include)
    TypeError: unsupported operand type(s) for +: 'set' and 'set'

    The reason may be that in Python3.2, + operator is not supported anymore.
    So the fix is replace:
    include = include + sum(always_include)
    with
    include = include.intersection(sum(always_include))

    BRs, Kimi
    ????

    <http://www.chachafille.com>

    On Sun, Jan 22, 2012 at 12:30 PM, David Robinow wrote:
    On Sat, Jan 21, 2012 at 6:56 PM, Greg Ewing wrote:
    ??? wrote:
    I found one small bugs in PyGUI when I run blobedit.py under python 3.2:

    File "C:\Python32\lib\site-packages\GUI\GStdMenus.py", line 82
    include = include + sum(always_include)
    ^
    TabError: inconsistent use of tabs and spaces in indentation

    *Fix:*
    Replace line 81 in C:\Python32\lib\site-packages\GUI\GStdMenus.py:

    #include = include + sum(always_include)
    include = include.intersection(sum(always_include))

    I don't understand this. There doesn't seem to be anything wrong with
    the indentation around that line in my source, and even if there was,
    I don't see how the change you suggest would fix it, except by the
    side effect of changing the whitespace.

    Is this a bug in Python 3.2? Has anyone else seen this? I don't have
    a 3.2 installation at hand to test it on, and I'm reluctant to change
    anything until I understand what's going on better.

    --
    Greg
    I think the OP must have caused an indentation error trying to fix the bug.
    I get the following (Vista PyGUI-2.5.3 Python3.2.2)
    Traceback (most recent call last):
    File "blobedit.py", line 132, in <module>
    BlobApp().run()
    File "c:\python32\lib\site-packages\GUI\GApplications.py", line 144, in
    run
    self.menus = basic_menus()
    File "c:\python32\lib\site-packages\GUI\StdMenus.py", line 53, in
    basic_menus
    exclude = exclude)
    File "c:\python32\lib\site-packages\GUI\GStdMenus.py", line 81,in
    build_menus
    include = include + sum(always_include)
    TypeError: unsupported operand type(s) for +: 'set' and 'set'

    The demo runs with the proposed fix but it also runs using "union"
    rather than "intersection" which seems more appropriate for the '+'
    operator. But I don't really understand the code very well. Probably
    the correct solution is to make '+' work.
    I haven't tried any fix on Python 2.
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/pygui/attachments/20120122/c5c26f79/attachment.html>
  • Greg Ewing at Jan 22, 2012 at 7:41 am

    David Robinow wrote:
    I think the OP must have caused an indentation error trying to fix the bug.
    I get the following (Vista PyGUI-2.5.3 Python3.2.2)
    File "c:\python32\lib\site-packages\GUI\GStdMenus.py", line 81,in build_menus
    include = include + sum(always_include)
    TypeError: unsupported operand type(s) for +: 'set' and 'set'
    Well, this is annoying. In Python 3, the set type seems to
    have changed so that operations on subclasses of set return
    plain sets, rather than instances of the subclass.

    I'll have to fix the CommandSet class to take this into
    account.

    --
    Greg

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppygui @
categoriespython
postedJan 21, '12 at 11:56p
activeJan 22, '12 at 7:41a
posts4
users3
websitecosc.canterbury.ac.nz...

People

Translate

site design / logo © 2019 Grokbase