Kivy: ArgumentError: argument 3: <class 'TypeError'>: wrong type

Created on 20 Jul 2019  ·  7Comments  ·  Source: kivy/kivy

Issue
I test the kivy code by Miniconda3(also test it in Anaconda3,the same issus appeard),
Every time I press F5 for the first time, the code runs normally,and kivy interface appears normally, as follow:

runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')
[INFO   ] [Logger      ] Record log in C:\Users\38477\.kivy\logs\kivy_19-07-20_1.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "G:\Miniconda3\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "G:\Miniconda3\pythonw.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.0.0 - Build 10.18.10.4885'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 4000'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 0
[INFO   ] [GL          ] Shading version <b'4.00 - Build 10.18.10.4885'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <16>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [WindowSDL   ] exiting mainloop and closing.
[INFO   ] [Base        ] Leaving application in progress...

but after colsing kivy interface ,pressing F5 will report the following error.
```
runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')
[INFO ] [Base ] Start application main loop
[ERROR ] [Base ] No event listeners have been created
[ERROR ] [Base ] Application will leave
[INFO ] [Base ] Leaving application in progress...
[INFO ] [Base ] Leaving application in progress...
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')

File "G:\Miniconda3lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "G:\Miniconda3lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/38477/.spyder-py3/temp.py", line 15, in
TestApp().run()

File "G:\Miniconda3lib\site-packages\kivy\app.py", line 855, in run
runTouchApp()

File "G:\Miniconda3lib\site-packages\kivy\base.py", line 506, in runTouchApp
stopTouchApp()

File "G:\Miniconda3lib\site-packages\kivy\base.py", line 521, in stopTouchApp
EventLoop.close()

File "G:\Miniconda3lib\site-packages\kivy\base.py", line 172, in close
self.stop()

File "G:\Miniconda3lib\site-packages\kivy\base.py", line 184, in stop
provider.stop()

File "G:\Miniconda3lib\site-packages\kivy\input\providers\wm_pen.py", line 111, in stop
SetWindowLong_WndProc_wrapper(self.hwnd, self.old_windProc)

File "G:\Miniconda3lib\site-packages\kivy\input\providers\wm_common.py", line 122, in _closure
oldAddr = func(hWnd, GWL_WNDPROC, cast(wndProc, c_void_p).value)

ArgumentError: argument 3: : wrong type

Restart the kernel is a feasible method, but this means that I must restart the kernel every time after runing the code. Is is normal?

**Environment**

active environment : base
active env location : G:\Miniconda3
shell level : 1
user config file : C:\Users\38477.condarc
populated config files :
conda version : 4.7.9
conda-build version : not installed
python version : 3.7.3.final.0
virtual packages : __cuda=9.1
base environment : G:\Miniconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : G:\Miniconda3\pkgs
C:\Users\38477.conda\pkgs
C:\Users\38477AppData\Local\conda\conda\pkgs
envs directories : G:\Miniconda3\envs
C:\Users\38477.conda\envs
C:\Users\38477AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.7.9 requests/2.21.0 CPython/3.7.3 Windows/10 Windows/10.0.17134
administrator : False
netrc file : None
offline mode : False

here is the test code I got from https://kivy.org/#home

from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
def build(self):
return Button(text='Hello World')

TestApp().run()
```

Most helpful comment

I was facing the same issue. Finally solved it by executing the code in external terminal.
Go to tools>preferences>run>execute in an external system terminal and then click ok.

All 7 comments

F5 doesn't do anything for kivy so I'm not sure what you mean. Do you mean pressing F5 in spyder? I can't really help you with spyder as I don't use it.

Are you trying to run kivy multiple times within the same python execution? Normally you need to restart python if you want to run kivy multiple times because kivy is meant to be run as an app that starts fresh every time it is run. There are ways to have kivy clean up after itself, but those are not officially documented.

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further.

I was facing the same issue. Finally solved it by executing the code in external terminal.
Go to tools>preferences>run>execute in an external system terminal and then click ok.

I had the same issue trying to run with Jupyter Notebook and Pycharm...
I managed to open it with Spyder.

I was facing the same issue with Spyder. The solution is Go to Consoles>"Restart Kernel" before Run the App .

I was facing the same issue in Jupiter notebook. Go to kernel and restart and run all.

thank you,it's a viable way to solution,but a little complex,
whether there is a option to set to deal with it?

nhamde1998 notifications@github.com 于2020年4月11日周六 下午5:25写道:

I was facing the same issue in Jupiter notebook. Go to kernel and restart
and run all.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/kivy/kivy/issues/6428#issuecomment-612376719, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AFU3OF7P2JSEEXVGJED6PA3RMAZPVANCNFSM4IFNCNVQ
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hansent picture hansent  ·  3Comments

sbrother picture sbrother  ·  4Comments

shifters67 picture shifters67  ·  6Comments

thagh05t picture thagh05t  ·  5Comments

damienflament picture damienflament  ·  3Comments