TreviD / aliddns

aliddns by python
MIT License
60 stars 53 forks source link

群晖上执行失败,报错 #7

Closed hizjz closed 4 years ago

hizjz commented 4 years ago

报错内容: Traceback (most recent call last): File "/volume1/share/aliddns.py", line 310, in <module> print("\u5f00\u59cb\u5904\u7406: RR:" + RR + " DomainName:" + DomainName) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) 本人小白,求教大佬

TreviD commented 4 years ago

??未复现,是用的python3 执行的么?

TreviD commented 4 years ago

已经更新,按照最新的方法在群晖计划任务里添加编码信息,看下是否可以解决!

samuelgaocn commented 4 years ago

import codecs sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())

我是加了这几行代码,好像是群晖显示的时候输出有问题,如果把输出重定到文件也没有问题。

TreviD commented 4 years ago

是在执行之前设置一下环境变量

export PYTHONIOENCODING=utf8
export LANG=en_US.utf8
xiaotiantian1132 commented 4 years ago

报如下错误:Traceback (most recent call last): File "/volume1/homes/xiaotiantian/aliddns.py", line 320, in print("本机IP: " + ip) TypeError: Can't convert 'NoneType' object to str implicitly

andywoooo commented 4 years ago

报如下错误:Traceback (most recent call last): File "/volume1/homes/xiaotiantian/aliddns.py", line 320, in print("本机IP: " + ip) TypeError: Can't convert 'NoneType' object to str implicitly

脚本中

ip addr show eth0 | grep "inet6.global" | awk \'{print $2}\' | awk -F"/" \'{print $1}\' 改成 ip addr show eth0 | grep "inet6.global" | awk \'{print $2}\' | awk -F"/" \'{print $1}\' | awk \'END{print}\'

再运行就行了

TreviD commented 4 years ago

现在已经改成优先从网络获取ipv6地址了

xiaotiantian1132 commented 4 years ago

感谢无私奉献 点赞 已经搞定

------------------ 原始邮件 ------------------ 发件人: "TreviD/aliddns" <notifications@github.com>; 发送时间: 2020年9月8日(星期二) 上午8:52 收件人: "TreviD/aliddns"<aliddns@noreply.github.com>; 抄送: "小天天"<1132524727@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [TreviD/aliddns] 群晖上执行失败,报错 (#7)

现在已经改成优先从网络获取ipv6地址了

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

tsui603 commented 3 years ago

现在已经改成优先从网络获取ipv6地址了

用最新版的还是有这个问题,按照你这个改了之后就好了