dathosim / Pronote2Homeassistant

Tuto et bout de code pour ajouter des éléments de Pronote dans Home assistant
Apache License 2.0
42 stars 20 forks source link

Line 283: "__file__" is an invalid variable name because it starts with "_" #17

Closed WiBlum closed 1 year ago

WiBlum commented 1 year ago

Bien le bonsoir,J'ai un problème avec les sur file sur la ligne 283, quelqu'un peut m'aider ? merci ;)

WiBlum commented 1 year ago

Je crois avoir trouvé sur un post qu'il faut enlever les avant et après file, mais j'ai un autre soucis :

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/python_script/__init__.py", line 224, in execute
    exec(compiled.code, restricted_globals)
  File "pronote.py", line 1, in <module>
ImportError: __import__ not found
WiBlum commented 1 year ago

Ok, il me manquait pip :/ Manque de bole, je l'ai donc installé.


(Intallez le comme ça) Faite tourner SSH & Web Terminal, pour ma part j'utilise puTTY et je l'ai utilisé pour générer ma clé, d'une simplicité ... 🤌 Ensuite entrez la commande : apk add python3 py3-pip si vous utilisez puTTY comme Terminal, utilisez clic droit de la souris dans le terminal pour coller, oui ctrl v et ctrl maj v ne fonctionne pas ici.

N'hésitez pas à tenter d'installer par la suite pronotepy à partir de pip : pip install pronotepy

Sinon, regardez ces tutos ;) Enable SSH In Home Assistant - TUTORIAL 2022 | YouTube Apk add python3 py3-pip | Medium

MAIS, nouveau code d'erreur :

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1191, in _sendfile_fallback
    read = await self.run_in_executor(None, file.readinto, view)
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 514, in start
    resp, reset = await task
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 460, in _handle_request
    reset = await self.finish_response(request, resp, start_time)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 613, in finish_response
    await prepare_meth(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_fileresponse.py", line 286, in prepare
    return await self._sendfile(request, fobj, offset, count)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_fileresponse.py", line 99, in _sendfile
    await loop.sendfile(transport, fobj, offset, count)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1170, in sendfile
    return await self._sendfile_fallback(transport, file,
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1200, in _sendfile_fallback
    await proto.restore()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 268, in restore
    self._transport.resume_reading()
  File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 343, in resume_reading
    self._ssl_protocol._transport.resume_reading()
AttributeError: 'NoneType' object has no attribute 'resume_reading'
dathosim commented 1 year ago

du coup le probleme est résolu meme si dans ma version j'ai gardé les "__" et ça fonctionne