Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何解决:[Error] 出现错误: <class 'UnboundLocalError'> #4

Closed
happyokay opened this issue Jan 21, 2024 · 6 comments
Closed

Comments

@happyokay
Copy link

你好,
我的 api 应该都设置好了,发了一条嘟文,然后卡在这里无限循环了,怎么办?

[opc@wiki Mastodon-to-Twitter-Sync]$ python mtSync.py
[2024-01-21 11:46:37] [Init] 同步检查间隔: 60 秒
[2024-01-21 11:46:37] [Init] 同步到日志文件: 是
[2024-01-21 11:46:37] [Init] 最大重试次数/等待时间(秒): 13 / 1800.0
[2024-01-21 11:46:38] [Init] 验证 Mastodon API 授权成功,用户名: hx
[2024-01-21 11:46:39] [Init] 验证 Twitter API 授权成功,用户名: happy xiao 🧑‍💻 aa.ee

[2024-01-21 11:46:39] [Check] 子线程:开始监控新嘟文...
[2024-01-21 11:47:39] [Check] 发现新嘟文:111793774042393464 已加入待同步列表
[2024-01-21 11:47:40] [Error] 出现错误: <class 'UnboundLocalError'>
1
[2024-01-21 11:47:40] [Error] 尝试重试...
[2024-01-21 11:47:41] [Error] 出现错误: <class 'UnboundLocalError'>
2
[2024-01-21 11:47:41] [Error] 尝试次数:#2,等待 3 秒后下一次重试...
[2024-01-21 11:47:44] [Error] 出现错误: <class 'UnboundLocalError'>
3
[2024-01-21 11:47:44] [Error] 尝试次数:#3,等待 6 秒后下一次重试...
[2024-01-21 11:47:51] [Error] 出现错误: <class 'UnboundLocalError'>
4
[2024-01-21 11:47:51] [Error] 尝试次数:#4,等待 12 秒后下一次重试...
^CException ignored in: <module 'threading' from '/usr/lib64/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib64/python3.6/threading.py", line 1315, in _shutdown
t.join()
File "/usr/lib64/python3.6/threading.py", line 1077, in join
self._wait_for_tstate_lock()
File "/usr/lib64/python3.6/threading.py", line 1093, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt

@happyokay
Copy link
Author

SCR-20240206-sflm

换了好几台小鸡,都这样

@DetectiveRainy
Copy link

我也是一样的情况

@XiaoMouz
Copy link
Contributor

加todo了,没看到不好意思(
明天晚上查

可以麻烦提供一下 python 版本以及联邦站点(或者站点是什么平台的)

@happyokay
Copy link
Author

happyokay commented Feb 25, 2024 via email

@Nakolu
Copy link
Contributor

Nakolu commented Feb 26, 2024

加todo了,没看到不好意思( 明天晚上查

可以麻烦提供一下 python 版本以及联邦站点(或者站点是什么平台的)

python3.9 版本出现该问题,在 debian12 和 win10 平台运行都会出现 <class 'UnboundLocalError'> 报错

注释掉如下代码后,程序正常运行

  # # 检查嘟文结尾是否以 “#no_sync” tag 结尾
    # if toot_text.endswith('#no_sync'):
    #     tprint(colored('[Check] 嘟文结尾包含不同步标签 #no_sync ,跳过...','green'))
    #     save_synced_toots(toot_id)
    #     return 0

@RimoOvO
Copy link
Owner

RimoOvO commented Feb 26, 2024

fixed at aceaf08

@RimoOvO RimoOvO closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants