kv language, parser error? 
Posted: 30 September 2013 06:31 AM   [ Ignore ]
Rank
Joined  2013-09-29
Total Posts:  1
New Member

Hi all,

Ive been using Kivy for around 3-4 days now and im liking except for one thing. When i actually think im getting somewhere all of a sudden i get an error when trying to run my program.

I am convinced its a bug with the software, im hoping its just because i’ve made a mistake.

the kv file looks like this:

[/code]
#:kivy 1.7.2
<ScanTool>:

    
FloatLayout:
            
scanbtnscanbtn
        Button
:
            
text"Scan-Network"
            
size_hint.2.1
            pos
300,200
            id
scanbtn
            on_press
root.scan()

        
Label:
            
text"192.168.10."
            
pos: -250250

        TextInput
:
            
ids_range
            text
"0"
            
size_hintNoneNone
            size
4030
            pos
200535

        Label
:
            
text"192.168.10."
            
pos: -250200

        TextInput
:
            
idl_range
            text
"254"
            
size_hintNoneNone
            size
4030
            pos
200485

        Label
:
            
text'hello'
[code]

When i run with my main.py i get this error:

Traceback (most recent call last):
File “main.py”, line 55, in <module>
ScanApp().run()
File “/usr/lib/python2.7/dist-packages/kivy/app.py”, line 576, in run
self.load_kv(filename=self.options.get(’kv_file’wink)
File “/usr/lib/python2.7/dist-packages/kivy/app.py”, line 399, in load_kv
root = Builder.load_file(filename)
File “/usr/lib/python2.7/dist-packages/kivy/lang.py”, line 1323, in load_file
return self.load_string(data, **kwargs)
File “/usr/lib/python2.7/dist-packages/kivy/lang.py”, line 1360, in load_string
parser = Parser(content=string, filename=fn)
File “/usr/lib/python2.7/dist-packages/kivy/lang.py”, line 930, in __init__
self.parse(content)
File “/usr/lib/python2.7/dist-packages/kivy/lang.py”, line 1003, in parse
objects, remaining_lines = self.parse_level(0, lines)
File “/usr/lib/python2.7/dist-packages/kivy/lang.py”, line 1099, in parse_level
level + 1, lines[i:], spaces)
File “/usr/lib/python2.7/dist-packages/kivy/lang.py”, line 1152, in parse_level
if current_property[:3] == ‘on_’:
TypeError: ‘NoneType’ object has no attribute ‘__getitem__’

Please if anybody could enlighten me and tell me its because i’m being a stupid idiot it would be great!
Just to note everything worked fine, i must have added maybe one more element to the kv file and it broke. I then removed it but nothing changed.

I’d also like to add that i know the scanbtn:scanbtn at the top should break it but it worked fine before. It seems to me that Kivy is reading the kv file wrong ive also had supposed indentation errors when the indentation was perfect. Somebody please this is driving me nuts.

Thanks in advance for any replies.

Profile