FileDropTarget TypeError in Phoenix

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

FileDropTarget TypeError in Phoenix

Mike Driscoll-2
Hi,

I am getting a TypeError when I drag and drop files onto a widget in wxPython Phoenix, but only to stdout. It doesn't actually cause the script to stop. Here's the error:

builtins.TypeError: invalid result from MyFileDropTarget.OnDropFiles(), an integer is required (got type NoneType)


This code worked fine in wxPython 3.0 Classic. Interestingly the code works as expected other than the odd output that goes to stdout.

Does anyone know why this is happening? I am running Phoenix on Windows 7 with Python 3.5.

Thanks,
Mike

-----------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org
Books: Python 101, Python 201: Intermediate Python 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: FileDropTarget TypeError in Phoenix

Mike Driscoll-2


On Sunday, November 27, 2016 at 2:06:53 PM UTC-6, mike wrote:
Hi,

I am getting a TypeError when I drag and drop files onto a widget in wxPython Phoenix, but only to stdout. It doesn't actually cause the script to stop. Here's the error:

builtins.TypeError: invalid result from MyFileDropTarget.OnDropFiles(), an integer is required (got type NoneType)

My code is here: <a href="https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fdriscollis%2Fa71018bc138a4c1974bca90e30d9f0e4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFe5yReUPo2sI6zL0MYbqfC090zpA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fdriscollis%2Fa71018bc138a4c1974bca90e30d9f0e4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFe5yReUPo2sI6zL0MYbqfC090zpA&#39;;return true;">https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4

This code worked fine in wxPython 3.0 Classic. Interestingly the code works as expected other than the odd output that goes to stdout.

Does anyone know why this is happening? I am running Phoenix on Windows 7 with Python 3.5.

Thanks,
Mike


Interestingly, I get pretty much the same error with a TextDropTarget as well. PyDropTarget's work fine for me though.

Mike

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: FileDropTarget TypeError in Phoenix

Scott Talbert
In reply to this post by Mike Driscoll-2
On Sun, 27 Nov 2016, Mike Driscoll wrote:

> Hi,
>
> I am getting a TypeError when I drag and drop files onto a widget in
> wxPython Phoenix, but only to stdout. It doesn't actually cause the script
> to stop. Here's the error:
>
> builtins.TypeError: invalid result from MyFileDropTarget.OnDropFiles(), an
> integer is required (got type NoneType)
> My code is
> here: https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4
>
> This code worked fine in wxPython 3.0 Classic. Interestingly the code works
> as expected other than the odd output that goes to stdout.
>
> Does anyone know why this is happening? I am running Phoenix on Windows 7
> with Python 3.5.
I think it's probably complaining because you're not returning a bool in
OnDropFiles.

Scott

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: FileDropTarget TypeError in Phoenix

Mike Driscoll


On Sunday, November 27, 2016 at 5:28:04 PM UTC-6, Scott Talbert wrote:
On Sun, 27 Nov 2016, Mike Driscoll wrote:

> Hi,
>
> I am getting a TypeError when I drag and drop files onto a widget in
> wxPython Phoenix, but only to stdout. It doesn't actually cause the script
> to stop. Here's the error:
>
> builtins.TypeError: invalid result from MyFileDropTarget.OnDropFiles(), an
> integer is required (got type NoneType)
> My code is
> here: <a href="https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fdriscollis%2Fa71018bc138a4c1974bca90e30d9f0e4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFe5yReUPo2sI6zL0MYbqfC090zpA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fdriscollis%2Fa71018bc138a4c1974bca90e30d9f0e4\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFe5yReUPo2sI6zL0MYbqfC090zpA&#39;;return true;">https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4
>
> This code worked fine in wxPython 3.0 Classic. Interestingly the code works
> as expected other than the odd output that goes to stdout.
>
> Does anyone know why this is happening? I am running Phoenix on Windows 7
> with Python 3.5.

I think it's probably complaining because you're not returning a bool in
OnDropFiles.

Scott

That does seem to be the issue. Do you know if that is documented somewhere?

Thanks,
Mike

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: FileDropTarget TypeError in Phoenix

Scott Talbert
On Mon, 28 Nov 2016, Mike Driscoll wrote:

> On Sunday, November 27, 2016 at 5:28:04 PM UTC-6, Scott Talbert wrote:
>       On Sun, 27 Nov 2016, Mike Driscoll wrote:
>
>       > Hi,
>       >
>       > I am getting a TypeError when I drag and drop files onto a
>       widget in
>       > wxPython Phoenix, but only to stdout. It doesn't actually
>       cause the script
>       > to stop. Here's the error:
>       >
>       > builtins.TypeError: invalid result from
>       MyFileDropTarget.OnDropFiles(), an
>       > integer is required (got type NoneType)
>       > My code is
>       >
>       here: https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4
>       >
>       > This code worked fine in wxPython 3.0 Classic. Interestingly
>       the code works
>       > as expected other than the odd output that goes to stdout.
>       >
>       > Does anyone know why this is happening? I am running Phoenix
>       on Windows 7
>       > with Python 3.5.
>
>       I think it's probably complaining because you're not returning a
>       bool in
>       OnDropFiles.
>
>       Scott
>
>
> That does seem to be the issue. Do you know if that is documented somewhere?
The wxWidgets documentation mentions it:
http://docs.wxwidgets.org/3.1/classwx_file_drop_target.html

The Phoenix version could probably be a bit more informative:
https://wxpython.org/Phoenix/docs/html/wx.FileDropTarget.html

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: FileDropTarget TypeError in Phoenix

Mike Driscoll-2



On Mon, Nov 28, 2016 at 10:27 AM, Scott Talbert <[hidden email]> wrote:
On Mon, 28 Nov 2016, Mike Driscoll wrote:

On Sunday, November 27, 2016 at 5:28:04 PM UTC-6, Scott Talbert wrote:
      On Sun, 27 Nov 2016, Mike Driscoll wrote:

      > Hi,
      >
      > I am getting a TypeError when I drag and drop files onto a
      widget in
      > wxPython Phoenix, but only to stdout. It doesn't actually
      cause the script
      > to stop. Here's the error:
      >
      > builtins.TypeError: invalid result from
      MyFileDropTarget.OnDropFiles(), an
      > integer is required (got type NoneType)
      > My code is
      >
      here: https://gist.github.com/driscollis/a71018bc138a4c1974bca90e30d9f0e4
      >
      > This code worked fine in wxPython 3.0 Classic. Interestingly
      the code works
      > as expected other than the odd output that goes to stdout.
      >
      > Does anyone know why this is happening? I am running Phoenix
      on Windows 7
      > with Python 3.5.

      I think it's probably complaining because you're not returning a
      bool in
      OnDropFiles.

      Scott


That does seem to be the issue. Do you know if that is documented somewhere?

The wxWidgets documentation mentions it:
http://docs.wxwidgets.org/3.1/classwx_file_drop_target.html

The Phoenix version could probably be a bit more informative:
https://wxpython.org/Phoenix/docs/html/wx.FileDropTarget.html




I missed that somehow. Thanks for taking the time to find that.

Mike

-----------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.