Closed ghost closed 3 years ago
C:\Python39\python.exe G:/Python/PycharmWorkspace/mobileApp/main.py [INFO ] [Logger ] Record log in C:\Users\RJ.kivy\logs\kivy_21-01-15_25.txt [INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.1 [INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.0 [INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0 [INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1 [INFO ] [Kivy ] v2.0.0rc4, git-b714003, 20201204 [INFO ] [Kivy ] Installed at "C:\Python39\lib\site-packages\kivy__init__.py" [INFO ] [Python ] v3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] [INFO ] [Python ] Interpreter at "C:\Python39\python.exe" [INFO ] [Logger ] Purge log fired. Analysing... [INFO ] [Logger ] Purge 5 log files [INFO ] [Logger ] Purge finished! [INFO ] [Factory ] 186 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored) Traceback (most recent call last): File "G:\Python\PycharmWorkspace\mobileApp\main.py", line 7, in Builder.load_string(""" File "C:\Python39\lib\site-packages\kivy\lang\builder.py", line 373, in load_string parser = Parser(content=string, filename=fn) File "C:\Python39\lib\site-packages\kivy\lang\parser.py", line 402, in init self.parse(content) File "C:\Python39\lib\site-packages\kivy\lang\parser.py", line 511, in parse objects, remaining_lines = self.parse_level(0, lines) File "C:\Python39\lib\site-packages\kivy\lang\parser.py", line 581, in parse_level raise ParserException(self, ln, 'Identifier missing') kivy.lang.parser.ParserException: Parser: File "", line 2: ... 1:
2:: 3: BoxLayout: 4: orientation: 'vertical' ... Identifier missing
the code is from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Screen import json import requests Builder.load_string(""" : BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 GridLayout: rows: 2 cols: 2 padding: 10 spacing: 10 row_default_height: 30 Label: text: 'Username' TextInput: id: usernamevalue Label: text: 'Password' TextInput: id: passwordvalue password: True Button: text: 'Login' on_press: root.login_button_action() : BoxLayout: orientation: 'vertical' Label: text: 'Failed Login' Button: text: 'Back to login' on_press: root.manager.current = 'login' """) class LoginScreen(Screen): def build(self): pass def login_button_action(self): url = 'https://reqres.in/api/login' # data = json.dumps({"email": "eve.holt@reqres.in","password": "cityslicka"}) data = json.dumps({"email": self.ids.usernamevalue.text, "password": self.ids.passwordvalue.text}) response = requests.post(url, data=data, headers={'Content-Type': 'application/json'}) userdata = json.loads(response.text) if userdata.get("token"): print("Logging in") else: self.manager.current = 'failedlogin' class FailedLoginScreen(Screen): pass sm = ScreenManager() sm.add_widget(LoginScreen(name='login')) sm.add_widget(FailedLoginScreen(name='failedlogin')) class MainApp(App): def build(self): self.title = "Task Manager" return sm if __name__ == '__main__': MainApp().run()
For .kv language and general Kivy usage, use the Users Group https://groups.google.com/g/kivy-users
ok, thank you
Versions
Description
C:\Python39\python.exe G:/Python/PycharmWorkspace/mobileApp/main.py [INFO ] [Logger ] Record log in C:\Users\RJ.kivy\logs\kivy_21-01-15_25.txt [INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.1 [INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.0 [INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0 [INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1 [INFO ] [Kivy ] v2.0.0rc4, git-b714003, 20201204 [INFO ] [Kivy ] Installed at "C:\Python39\lib\site-packages\kivy__init__.py" [INFO ] [Python ] v3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] [INFO ] [Python ] Interpreter at "C:\Python39\python.exe" [INFO ] [Logger ] Purge log fired. Analysing... [INFO ] [Logger ] Purge 5 log files [INFO ] [Logger ] Purge finished! [INFO ] [Factory ] 186 symbols loaded [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored) Traceback (most recent call last): File "G:\Python\PycharmWorkspace\mobileApp\main.py", line 7, in
Builder.load_string("""
File "C:\Python39\lib\site-packages\kivy\lang\builder.py", line 373, in load_string
parser = Parser(content=string, filename=fn)
File "C:\Python39\lib\site-packages\kivy\lang\parser.py", line 402, in init
self.parse(content)
File "C:\Python39\lib\site-packages\kivy\lang\parser.py", line 511, in parse
objects, remaining_lines = self.parse_level(0, lines)
File "C:\Python39\lib\site-packages\kivy\lang\parser.py", line 581, in parse_level
raise ParserException(self, ln, 'Identifier missing')
kivy.lang.parser.ParserException: Parser: File "", line 2:
...
1: