async def getweather():
# declare the client. format defaults to the metric system (celcius, km/h, etc.)
async with python_weather.Client(format=python_weather.IMPERIAL) as client:
# fetch a weather forecast from a city
weather = await client.get("Крым")
Новые ошибки
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\pythonProject\main.py", line 23, in
asyncio.run(getweather())
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "C:\Users\user\PycharmProjects\pythonProject\main.py", line 9, in getweather
weather = await client.find("New York")
File "C:\Users\user\PycharmProjects\pythonProject\venv\lib\site-packages\python_weather\client.py", line 36, in find
return await self.http.request(location)
File "C:\Users\user\PycharmProjects\pythonProject\venv\lib\site-packages\python_weather\rest.py", line 19, in request
parsed = parse(await resp.text())
File "C:\Users\user\PycharmProjects\pythonProject\venv\lib\site-packages\xmltodict.py", line 378, in parse
parser.Parse(xml_input, True)
xml.parsers.expat.ExpatError: mismatched tag: line 4, column 2
Unclosed client session
client_session:
Unclosed connector
connections: ['[(, 174.203)]']
connector:
Fatal error on SSL transport
protocol:
transport: <_ProactorSocketTransport fd=628 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 684, in _process_write_backlog
self._transport.write(chunk)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 361, in write
self._loop_writing(data=bytes(data))
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 397, in _loop_writing
self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 321, in __del__
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 316, in close
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 593, in _start_shutdown
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 598, in _write_appdata
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 706, in _process_write_backlog
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 720, in _fatal_error
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 151, in _force_close
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
И к этому теперь на конце кода в любом случаи сиреневая черта
Написано
Войдите на сайт
Чтобы задать вопрос и получить на него квалифицированный ответ.