Simple Kivy app crashes (release unlocked lock) - kivy

I am getting the following error when trying to run even the simplest of Kivy apps:
C:\Users\kprice\Desktop>python test.py
[INFO ] [Logger ] Record log in C:\Users\kprice\AppData\Roaming\SPB_16.6\.kivy\logs\kivy_17-03-03_57.txt
[INFO ] [Kivy ] v1.9.2.dev0, git-9f2daa0, 20170302
[INFO ] [Python ] v3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
[INFO ] [Factory ] 193 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [OSC ] using <thread> for socket
[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.3.0 - Build 10.18.15.4256'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 4400'>
[INFO ] [GL ] OpenGL parsed version: 4, 3
[INFO ] [GL ] Shading version <b'4.30 - Build 10.18.15.4256'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Shader ] fragment shader: <b"WARNING: 0:6: '' : #version directive missing">
[INFO ] [Shader ] vertex shader: <b"WARNING: 0:6: '' : #version directive missing">
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
Traceback (most recent call last):
File "test.py", line 13, in <module>
MyApp().run()
File "C:\Users\kprice\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\app.py", line 802, in run
root = self.build()
File "test.py", line 10, in build
return Label(text='Hello world')
File "C:\Users\kprice\AppData\Local\Programs\Python\Python36\lib\site-packages\kivy\uix\label.py", line 291, in __init__
self._trigger_texture()
File "kivy\_clock.pyx", line 75, in kivy._clock.ClockEvent.__call__ (kivy\_clock.c:2223)
RuntimeError: release unlocked lock
The code for the app is as follows:
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
Any ideas on why even the most basic program seems to crash?

That was a typo for a change in the kivy.clock code. It basically called the method twice, which it shouldn't (no thread lock to release).
I'm not sure if it's because of Cython or because of Windows, but I believe that error should return a ThreadError. There is too small amount of RuntimeErrors in Kivy, so I'm not sure why does it return a wrong type of error.

Related

How do I force dependencies into separate chunks using manualChunk?

manualChunks: {
'#dnd-kit/core': [
'#dnd-kit/core',
'#dnd-kit/sortable',
'#dnd-kit/utilities',
],
'#radix-ui/react-collapsible': [
'#radix-ui/react-collapsible',
'#radix-ui/react-dropdown-menu',
'#radix-ui/react-navigation-menu',
],
react: ['react', 'react-dom'],
'react-aria': [
'#react-aria/checkbox',
'#react-aria/dialog',
'#react-aria/focus',
'#react-aria/meter',
'#react-aria/visually-hidden',
'#react-aria/utils',
'#react-aria/tooltip',
'#react-aria/overlays',
'#react-aria/radio',
],
'react-stately': [
'#react-stately/radio',
'#react-stately/toggle',
'#react-stately/checkbox',
],
slate: [
'#contra/slate',
'slate',
'slate-react',
'slate-history',
'slate-hyperscript',
],
'stream-chat': ['stream-chat', 'stream-chat-react'],
stripe: ['#stripe/react-stripe-js', '#stripe/stripe-js'],
visx: [
'#visx/curve',
'#visx/event',
'#visx/gradient',
'#visx/responsive',
'#visx/scale',
'#visx/shape',
'#visx/tooltip',
],
},
The above is my rollupjs manualChunk configuration.
Based on this configuration, I would expect to have several chunks that group together these dependencies.
However, almost everything ends up in stream-chat chunk.
What's happening and how do I achieve the desired result?

Swift password validation using REGEX [duplicate]

I am working on a Swift project and I need to use this regex to check email is valid or not but when the app start the checking the app crash and give me this error:
NSInternalInconsistencyException', reason: 'Can't do regex matching, reason: Can't open pattern U_REGEX_MISSING_CLOSE_BRACKET
This is my REGEX:
^(([^<>()[\\]\\.,;:\\s#\\\"]+(\\.[^<>()[\\]\\.,;:\\s#\\\"]+)*)|(\\\".+\\\"))#((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+[\\.]*)+[a-zA-Z]{2,}))$
Check unescaped brackets in your regex pattern:
let pattern
= "^(([^<>()[\\]\\.,;:\\s#\\\"]+(\\.[^<>()[\\]\\.,;:\\s#\\\"]+)*)|(\\\".+\\\"))"
// [ [ ] [ [ ]
+ "#((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+[\\.]*)+[a-zA-Z]{2,}))$"
// [ ] [ ] [ ] [ ] [ ] [ ] [ ]
You have some mismatching brackets [ ] in the first half of your pattern.
In some dialects of regex, you have no need to escape [ between [ and ], but in some other dialects, you need it.
Try adding some escapes to your regex:
let pattern
= "^(([^<>()\\[\\]\\.,;:\\s#\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s#\\\"]+)*)|(\\\".+\\\"))"
// [ ^^ ] [ ^^ ]
+ "#((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+[\\.]*)+[a-zA-Z]{2,}))$"
// [ ] [ ] [ ] [ ] [ ] [ ] [ ]

Kivy imports SDL2, GLEW and ANGLE when new process start

I need to use Python Multiprocessing for some CPU Bound task. When I run my app and new process is created I see in kivy log that it imports a kivy.deps and some more stuff again. It takes a lot of time and it looks like window is created again. Why is that happening? I expected the app to just create new process and do only what MyProcess class is for.
LOG
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.2.0
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "C:\Users\Patryk\PycharmProjects\pythonProject\Random\venv_python\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
[INFO ] [Python ] Interpreter at "C:\Users\Patryk\PycharmProjects\pythonProject\Random\venv_python\Scripts\python.exe"
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[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.6.0 NVIDIA 441.66'>
[INFO ] [GL ] OpenGL vendor <b'NVIDIA Corporation'>
[INFO ] [GL ] OpenGL renderer <b'NVS 510/PCIe/SSE2'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 NVIDIA'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Base ] Start application main loop
[**IMPORTING DEPS AGAIN**]
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.2.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.2.0
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "C:\Users\Patryk\PycharmProjects\pythonProject\Random\venv_python\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
[INFO ] [Python ] Interpreter at "C:\Users\Patryk\PycharmProjects\pythonProject\Random\venv_python\Scripts\python.exe"
[INFO ] [Factory ] 184 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
MP RUN
[INFO ] [WindowSDL ] exiting mainloop and closing.
[INFO ] [Base ] Leaving application in progress...
Process finished with exit code 0
MY CODE
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.uix.boxlayout import BoxLayout
from multiprocessing import Process
kv = '''
MyWindow:
'''
class MyProcess(Process):
def __init__(self):
super().__init__()
def run(self):
print('MP RUN')
class MyWindow(BoxLayout):
def __init__(self, *args, **kwargs):
super().__init__(**kwargs)
mp = MyProcess()
mp.start()
class MyApp(App):
def build(self):
return Builder.load_string(kv)
if __name__ == '__main__':
MyApp().run()
I'm not sure offhand exactly what the new process inherits, but in this case you're clearly using it to run Python code that includes your kivy imports. Maybe you should use a separate file that doesn't include the imports you don't want, but I'm not sure what is the intention. The multiprocessing documentation may say something about the best way to avoid it.

Device Tree Bad Data (for PocketBeagle)

I am trying to create a device tree overlay for the PocketBeagle to interface to the MCP3204 ADC. I am trying to use the driver that exists already in the Linux kernel. My device tree source is the following:
/dts-v1/;
/plugin/;
/ {
compatible = "ti,am335x-pocketbeagle";
part-number = "mm-cape";
version = "00A0";
fragment#0 {
target = <&am33xx_pinmux>;
__overlay__ {
mm_chipselect: MM_CHIP_SELECT_PIN {
pinctrl-single,pin = <0xe8 0xf>;
};
};
};
fragment#1 {
target = <&ocp>;
__overlay__ {
mm_chipselect_helper: helper {
compatible = "bone-pinmux-helper";
pinctrl-names = "default";
pinctrl-0 = <&mm_chipselect>;
status = "okay";
};
};
};
fragment#2 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
cs-gpios = <&gpio2 24 0>, <0>, <0>, <0>;
mcp320x: mcp320x#0 {
compatible = "microchip,mcp3208";
reg = <0>;
spi-max-frequency = <1000000>;
};
};
};
};
When I load my device tree overlay I get the following output from dmesg:
[ 2.157460] pinctrl-single 44e10800.pinmux: bad data for mux MM_CHIP_SELECT_PIN
[ 2.164916] pinctrl-single 44e10800.pinmux: no pins entries for MM_CHIP_SELECT_PIN
[ 2.172687] pinctrl-single 44e10800.pinmux: bad data for mux MM_CHIP_SELECT_PIN
[ 2.180072] pinctrl-single 44e10800.pinmux: no pins entries for MM_CHIP_SELECT_PIN
[ 2.187700] bone-pinmux-helper ocp:helper: Failed to get pinctrl
[ 2.193762] ------------[ cut here ]------------
[ 2.193783] WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:888 devm_kfree+0x4c/0x50()
[ 2.193791] Modules linked in:
[ 2.193810] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.91-ti-r133 #1
[ 2.193818] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 2.193862] [<c001bed0>] (unwind_backtrace) from [<c0015978>] (show_stack+0x20/0x24)
[ 2.193885] [<c0015978>] (show_stack) from [<c05c1674>] (dump_stack+0x8c/0xa0)
[ 2.193905] [<c05c1674>] (dump_stack) from [<c004435c>] (warn_slowpath_common+0x94/0xc4)
[ 2.193919] [<c004435c>] (warn_slowpath_common) from [<c0044490>] (warn_slowpath_null+0x2c/0x34)
[ 2.193932] [<c0044490>] (warn_slowpath_null) from [<c0718418>] (devm_kfree+0x4c/0x50)
[ 2.193951] [<c0718418>] (devm_kfree) from [<c073bea8>] (bone_pinmux_helper_probe+0x1c4/0x260)
[ 2.193966] [<c073bea8>] (bone_pinmux_helper_probe) from [<c0716368>] (platform_drv_probe+0x60/0xc0)
[ 2.193990] [<c0716368>] (platform_drv_probe) from [<c0713fcc>] (driver_probe_device+0x234/0x470)
[ 2.194005] [<c0713fcc>] (driver_probe_device) from [<c07142a4>] (__driver_attach+0x9c/0xa0)
[ 2.194020] [<c07142a4>] (__driver_attach) from [<c0711a80>] (bus_for_each_dev+0x8c/0xd0)
[ 2.194035] [<c0711a80>] (bus_for_each_dev) from [<c0713728>] (driver_attach+0x2c/0x30)
[ 2.194049] [<c0713728>] (driver_attach) from [<c0713200>] (bus_add_driver+0x1b8/0x278)
[ 2.194062] [<c0713200>] (bus_add_driver) from [<c0714d94>] (driver_register+0x88/0x104)
[ 2.194075] [<c0714d94>] (driver_register) from [<c0716274>] (__platform_driver_register+0x50/0x58)
[ 2.194094] [<c0716274>] (__platform_driver_register) from [<c0f96218>] (bone_pinmux_helper_driver_init+0x1c/0x20)
[ 2.194113] [<c0f96218>] (bone_pinmux_helper_driver_init) from [<c00098e4>] (do_one_initcall+0xd8/0x228)
[ 2.194133] [<c00098e4>] (do_one_initcall) from [<c0f4c000>] (kernel_init_freeable+0x1ec/0x288)
[ 2.194152] [<c0f4c000>] (kernel_init_freeable) from [<c0aa4314>] (kernel_init+0x1c/0xf8)
[ 2.194172] [<c0aa4314>] (kernel_init) from [<c0010e00>] (ret_from_fork+0x14/0x34)
[ 2.194217] ---[ end trace 20e7a3ce9aa45d9c ]---
[ 2.194310] bone-pinmux-helper: probe of ocp:helper failed with error -22
[ 2.222490] spi spi1.0: failed to request gpio
[ 2.227072] omap2_mcspi 48030000.spi: can't setup spi1.0, status -16
[ 2.233483] spi_master spi1: spi_device register error /ocp/spi#48030000/mcp320x#0
[ 2.241309] spi_master spi1: Failed to create SPI device for /ocp/spi#48030000/mcp320x#0
I can't seem to find what the source of the error could be. I have confirmed using multiple other examples that the structure of the file should be correct, and that the pin offset and mux value are correct. What could be causing this error?

reading and writing a register linux device driver

I am writing a watchdog timer device driver for Pandaboard(Omap4) for educational purposes(I know the driver already exist). I want to know how I can access watchdog timer registers (e.g. WDT_WLDR(timer load register) has address offset 0x0000002C and Physical L4 interconnect address 0x4A31402C) in kernel space. Please guide in the write direction so that I can write my own watchdog device driver.
Regards
==================================================================================
Now I wrote this module however it is not working how it is supposed to be
ioread32(reg_WLDR) returns 0
==================================================================================
dmesg returns
[ 72.798461] Now in kernel space
[ 72.798583] Starting to read
[ 72.798583]
[ 72.798645] 0
[ 72.798645] ------------[ cut here ]------------
[ 72.798645] WARNING: at arch/arm/mach-omap2/omap_l3_noc.c:113 l3_interrupt_handler+0x)
[ 72.798706] L3 custom error: MASTER:MPU TARGET:L4CFG
[ 72.798706] Modules linked in: test_device(O+)
[ 72.798706] 2nd Read
[ 72.798736]
[ 72.798736] (null)
[ 72.798736]
[ 72.798797] [<c001a0f4>] (unwind_backtrace+0x0/0xec) from [<c003a298>] (warn_slowpath)
[ 72.798797] [<c003a298>] (warn_slowpath_common+0x4c/0x64) from [<c003a344>] (warn_slo)
[ 72.798797] [<c003a344>] (warn_slowpath_fmt+0x30/0x40) from [<c002efe8>] (l3_interrup)
[ 72.798858] [<c002efe8>] (l3_interrupt_handler+0x120/0x16c) from [<c0092af4>] (handle)
[ 72.798889] [<c0092af4>] (handle_irq_event_percpu+0x74/0x1f8) from [<c0092cb4>] (hand)
[ 72.798889] [<c0092cb4>] (handle_irq_event+0x3c/0x5c) from [<c0095958>] (handle_faste)
[ 72.798950] [<c0095958>] (handle_fasteoi_irq+0xd4/0x110) from [<c00925b4>] (generic_h)
[ 72.798950] [<c00925b4>] (generic_handle_irq+0x30/0x48) from [<c0014208>] (handle_IRQ)
[ 72.798950] [<c0014208>] (handle_IRQ+0x78/0xb8) from [<c00084b8>] (gic_handle_irq+0x8)
[ 72.799072] [<c00084b8>] (gic_handle_irq+0x80/0xac) from [<c04b74c4>] (__irq_svc+0x44)
[ 72.799072] Exception stack(0xece47ec0 to 0xece47f08)
[ 72.799102] 7ec0: ecdbc0e0 00000004 c0748c64 00000000 000080d0 c0743a88 ecdbc0e0 ee270
[ 72.799102] 7ee0: c0013328 00000000 c0c99720 00020348 ece46000 ece47f08 c0081c38 c03ac
[ 72.799102] 7f00: 60000013 ffffffff
[ 72.799102] [<c04b74c4>] (__irq_svc+0x44/0x60) from [<c03a610c>] (sk_prot_alloc+0x50/)
[ 72.799102] [<c03a610c>] (sk_prot_alloc+0x50/0x14c) from [<c03a6268>] (sk_alloc+0x1c/)
[ 72.799102] [<c03a6268>] (sk_alloc+0x1c/0xd8) from [<c042789c>] (unix_create1+0x50/0x)
[ 72.799255] [<c042789c>] (unix_create1+0x50/0x178) from [<c0427a34>] (unix_create+0x7)
[ 72.799255] [<c0427a34>] (unix_create+0x70/0x90) from [<c03a3878>] (__sock_create+0x1)
[ 72.799255] [<c03a3878>] (__sock_create+0x19c/0x2b8) from [<c03a3a10>] (sock_create+0)
[ 72.799316] [<c03a3a10>] (sock_create+0x40/0x48) from [<c03a3b8c>] (sys_socket+0x2c/0)
[ 72.799346] [<c03a3b8c>] (sys_socket+0x2c/0x68) from [<c0013160>] (ret_fast_syscall+0)
[ 72.799346] ---[ end trace 4316415ef3b8cf4c ]---
==================================================================================
Code
#include </home/salman/kernel_panda_compile/linux/include/linux/version.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/module.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/miscdevice.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/highmem.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/fs.h>
#include </home/salman/kernel_panda_compile/linux/arch/arm/include/asm/unistd.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/unistd.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/kernel.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/moduleparam.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/io.h>
#include </home/salman/kernel_panda_compile/linux/arch/arm/include/asm/io.h>
#include </home/salman/kernel_panda_compile/linux/include/linux/ioport.h>
static void *reg_WLDR;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Muhammad Salman Khalid");
MODULE_VERSION("0.100");
static int start_module(void)
{
int retval;
printk(KERN_INFO "Now in kernel space\n");
// retval = misc_register(&our_device);
reg_WLDR = ioremap(0x4A31402C,0x001);//0x4A31402C is the physical address (L4 Interconnect) of WDT_WLDR register of watchdog timer(pandaboard omap4) it is readable & writeable
iowrite32(252,reg_WLDR);
printk(KERN_ALERT "Starting to read\n");
printk(KERN_ALERT "\n%d\n",ioread32(reg_WLDR));
printk(KERN_ALERT "2nd Read\n");
printk(KERN_ALERT "\n%p\n",ioread32(reg_WLDR));
iounmap(reg_WLDR);
return retval;
}
static void finish_module(void)
{
printk(KERN_INFO "Leaving kernel space\n");
// misc_deregister(&our_device);
return;
}
module_init(start_module);
module_exit(finish_module);
If you plan to use Linux Kernel then you can use following api's for reading and writing to peripheral registers:
1. ioremap() (Map the physical address into kernel virtual memory)
2. ioread32() (Read from 32 bit register)
3. iowrite32() (Write to 32 bit register)
and finally iounmap() (Unmapping memory which you allocated with ioremap())
Now please refer to below two things:
1. OMAP4 datasheet/manual to get the physical address of registers.
2. Link for explaining above mentioned api's: http://www.makelinux.net/ldd3/chp-9-sect-4
Try replacing this line: ioremap(0x4A31402C,0x001) in your code with this: ioremap(0x4A31402C,0x04) and then check.

Resources