L
L
leshadyachkov2020-06-02 18:41:35
Python
leshadyachkov, 2020-06-02 18:41:35

How to properly pack .ru into .apk through a bulldozer?

Здравствуйте. Помогите пожалуйста. 
При попытке упаковать данный код получаю ошибку:
            код: 

<code lang="python">

</code>import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput

class MainApp(App):
    def build(self):
        self.operators = ["/", "*", "+", "-"]
        self.last_was_operator = None
        self.last_button = None
        main_layout = BoxLayout(orientation="vertical")
        self.solution = TextInput(
         multiline=False, readonly=True,  font_size=55
        )
        main_layout.add_widget(self.solution)
        buttons = [
            ["7", "8", "9", "/"],
            ["4", "5", "6", "*"],
            ["1", "2", "3", "-"],
            [".", "0", "C", "+"],
        ]
        for row in buttons:
            h_layout = BoxLayout()
            for label in row:
                button = Button(
                    text=label,
                    pos_hint={"center_x": 0.5, "center_y": 0.5},
                )
                button.bind(on_press=self.on_button_press)
                h_layout.add_widget(button)
            main_layout.add_widget(h_layout)

        equals_button = Button(
            text="=", pos_hint={"center_x": 0.5, "center_y": 0.5}
        )
        equals_button.bind(on_press=self.on_solution)
        main_layout.add_widget(equals_button)

        return main_layout

    def on_button_press(self, instance):
        current = self.solution.text
        button_text = instance.text

        if button_text == "C":
            # Очистка виджета с решением
            self.solution.text = ""
        else:
            if current and (
                self.last_was_operator and button_text in self.operators):
                # Не добавляйте два оператора подряд, рядом друг с другом
                return
            elif current == "" and button_text in self.operators:
                # Первый символ не может быть оператором
                return
            else:
                new_text = current + button_text
                self.solution.text = new_text
        self.last_button = button_text
        self.last_was_operator = self.last_button in self.operators

    def on_solution(self, instance):
        text = self.solution.text
        if text:
            solution = str(eval(self.solution.text))
            self.solution.text = solution


if __name__ == "__main__":
    app = MainApp()
    app.run()

и ошибка:

 C:\Users\алексей>buildozer -v android debug
Traceback (most recent call last):
  File "e:\питон\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "e:\питон\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "E:\питон\Scripts\buildozer.exe\__main__.py", line 7, in <module>
  File "e:\питон\lib\site-packages\buildozer\scripts\client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "e:\питон\lib\site-packages\buildozer\__init__.py", line 131, in __init__
    self.config.read(filename, "utf-8")
  File "e:\питон\lib\configparser.py", line 697, in read
    self._read(fp, filename)
  File "e:\питон\lib\configparser.py", line 1082, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'buildozer.spec', line: 1
'\ufeff[app]\n'

Что сделать что бы она не появлялась? Уже месяц не могу решения найти.
 Работаю только под ОС Виндовс, т.к. установить 
Люникс не имею возможности за неимением 
на своем ПК достаточного места

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-06-03
@shurshur

I don't understand anything about this bulldozer, but here the point is clearly here:
'\ufeff[app]\n'
The \ufeff symbol is a Unicode BOM , it must be removed from the file, because the specified script cannot interpret it correctly. Yes, the text editor does not show this symbol, this is a common thing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question