question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 "<ipython-input-2-83710e3ec7f9>", line 1, in <module>
   runfile('C:/Users/38477/.spyder-py3/temp.py', wdir='C:/Users/38477/.spyder-py3')

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

 File "G:\Miniconda3\lib\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 <module>
   TestApp().run()

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

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

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

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

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

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

 File "G:\Miniconda3\lib\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: <class 'TypeError'>: 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\38477\AppData\Local\conda\conda\pkgs
       envs directories : G:\Miniconda3\envs
                          C:\Users\38477\.conda\envs
                          C:\Users\38477\AppData\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()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
iamworldlywisecommented, Sep 14, 2019

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.

4reactions
scorpiotonytwcommented, Feb 11, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

ArgumentError: argument 3: <class 'TypeError'>: wrong type
I used to have the same problem, if you are using spyder you have 3 option to solve it: 1.close and open again...
Read more >
Ctypes argumenterror argument 3 class TypeError wrong type kivy ...
Ctypes argumenterror argument 3 class TypeError wrong type kivy. The following are 30 code examples for showing how to use ctypes.ArgumentError().
Read more >
Python Examples of ctypes.ArgumentError - ProgramCreek.com
When runing ``ptipython`` is run (only with IPython), we often got the following error:: Error in 'SetConsoleCursorPosition'. ArgumentError("argument 2: ...
Read more >
Could not start server: argument 2: class 'TypeError': wrong type
[RESOLVED]MYSQL Error: Could not start server: argument 2: class ' TypeError ': wrong type. 2.1K views 1 year ago.
Read more >
28632 (Manager.raw() crashes if the model has GIS fields)
ERROR: test_17_raw_query (gis_tests.relatedapp.test_new. ... ArgumentError: argument 3: <class 'TypeError'>: wrong type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found