Code Monkey home page Code Monkey logo

Comments (13)

SK-415 avatar SK-415 commented on June 29, 2024 2

给后来人总结一下:

WIN10 的时区设置可能因为迷之原因无效,这时需要去重新设置一下。

根据遇到这个问题的群友描述,他是在使用了 V2Ray 之后,时区设置就会无效,每次启动 V2Ray 之后都得重新修改时区设置。

设置方法:

  • 依次点开 控制面板 -> 时钟和区域 -> 更改时区,可以看到“无法识别你当前的时区……”

  • 直接更改时区即可

image

完成后如图
image

from nonebot2.

bytemain avatar bytemain commented on June 29, 2024 1

https://github.com/regebro/tzlocal/blob/2.1/tzlocal/win32.py#L84

看了一下你的报错,看起来跟这个 2.1 版本的 get_localzone_name 的实现有关,是上游问题。

相关issue:
regebro/tzlocal#103

建议重设一下本机时区,估计就好了

from nonebot2.

bytemain avatar bytemain commented on June 29, 2024

提供一下环境中 pytztzlocal 的版本(执行 pip list)。

pytz                   2020.1
pytzdata               2020.1
tzlocal                2.1

测试没有报错

from nonebot2.

synodriver avatar synodriver commented on June 29, 2024
pip list|findstr "pytz"
pytz                               2020.4
pip list|findstr "tzlocal"
tzlocal                            2.1

pytzdata 无(没有这个包)

from nonebot2.

bytemain avatar bytemain commented on June 29, 2024

安装一下 pytzdata 试试呢

image

pytz 2020.4 测试通过

from nonebot2.

synodriver avatar synodriver commented on June 29, 2024

一样的错误

from nonebot2.

bytemain avatar bytemain commented on June 29, 2024

首先确认你的 python 环境。
接下来在正确的 python 环境中:

贴一下 pip list 结果中的 pytz pytzdata tzlocal apscheduler 的版本
和在 python shell 中执行下面这段代码的结果的截图:

>>> from tzlocal import get_localzone

>>> get_localzone()

>>> from apscheduler.schedulers.asyncio import AsyncIOScheduler

>>> AsyncIOScheduler()

from nonebot2.

synodriver avatar synodriver commented on June 29, 2024
>>> from tzlocal import get_localzone
>>> get_localzone()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\Anaconda3\lib\site-packages\tzlocal\win32.py", line 93, in get_localzone
    _cache_tz = pytz.timezone(get_localzone_name())
  File "E:\Anaconda3\lib\site-packages\tzlocal\win32.py", line 84, in get_localzone_name
    raise pytz.UnknownTimeZoneError('Can not find timezone ' + tzkeyname)
pytz.exceptions.UnknownTimeZoneError: 'Can not find timezone '
>>> from apscheduler.schedulers.asyncio import AsyncIOScheduler
>>> AsyncIOScheduler()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "E:\Anaconda3\lib\site-packages\apscheduler\schedulers\base.py", line 87, in __init__
    self.configure(gconfig, **options)
  File "E:\Anaconda3\lib\site-packages\apscheduler\schedulers\base.py", line 126, in configure
    self._configure(config)
  File "E:\Anaconda3\lib\site-packages\apscheduler\schedulers\asyncio.py", line 48, in _configure
    super(AsyncIOScheduler, self)._configure(config)
  File "E:\Anaconda3\lib\site-packages\apscheduler\schedulers\base.py", line 697, in _configure
    self.timezone = astimezone(config.pop('timezone', None)) or get_localzone()
  File "E:\Anaconda3\lib\site-packages\tzlocal\win32.py", line 93, in get_localzone
    _cache_tz = pytz.timezone(get_localzone_name())
  File "E:\Anaconda3\lib\site-packages\tzlocal\win32.py", line 84, in get_localzone_name
    raise pytz.UnknownTimeZoneError('Can not find timezone ' + tzkeyname)
pytz.exceptions.UnknownTimeZoneError: 'Can not find timezone '
>>>    

以上是输出

from nonebot2.

bytemain avatar bytemain commented on June 29, 2024

贴一下 pip list 结果中的 pytz pytzdata tzlocal apscheduler 的版本

from nonebot2.

synodriver avatar synodriver commented on June 29, 2024

贴一下 pip list 结果中的 pytz pytzdata tzlocal apscheduler 的版本

APScheduler                        3.6.3
pytz                               2020.4
pytzdata                           2020.1
tzlocal                            2.1

from nonebot2.

bytemain avatar bytemain commented on June 29, 2024

跟我的版本都一模一样,我执行却都可以...

Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from tzlocal import get_localzone
>>> get_localzone()
<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>
>>> from apscheduler.schedulers.asyncio import AsyncIOScheduler
>>> AsyncIOScheduler()
<apscheduler.schedulers.asyncio.AsyncIOScheduler object at 0x0000020F8913BF40>

无法复现..

from nonebot2.

yanyongyu avatar yanyongyu commented on June 29, 2024

无法复现 +1

Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from tzlocal import get_localzone
>>> get_localzone()
<DstTzInfo 'Asia/Shanghai' LMT+8:06:00 STD>
>>> from apscheduler.schedulers.asyncio import AsyncIOScheduler
>>> AsyncIOScheduler()
<apscheduler.schedulers.asyncio.AsyncIOScheduler object at 0x0000020F8913BF40>

from nonebot2.

synodriver avatar synodriver commented on June 29, 2024

https://github.com/regebro/tzlocal/blob/2.1/tzlocal/win32.py#L84

看了一下你的报错,看起来跟这个 2.1 版本的 get_localzone_name 的实现有关,是上游问题。

相关issue:
regebro/tzlocal#103

建议重设一下本机时区,估计就好了

感谢,确实正常了,需要在控制面板设置时区

from nonebot2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.