小编Pip*_*pup的帖子

尝试在 Python 中列出 ftp 目录时出现 OSError

使用 Python 3.6.3。

我正在连接到 FTP 以ftplib通过 FTP_TLS使用。

ftps = ftplib.FTP_TLS('example.com', timeout=5)

# TLS is more secure than SSL
ftps.ssl_version = ssl.PROTOCOL_TLS

# login before securing control channel
ftps.login('username@example.com', 'password')

# switch to secure data connection
ftps.prot_p()

# Explicitly set Passive mode
ftps.set_pasv(True)
Run Code Online (Sandbox Code Playgroud)

这一切都有效。我可以发送ftps.mkd('mydir')(制作目录)和ftps.cwd('mydir')(更改工作目录),并且都可以正常工作。

但是,如果我发送其中任何一个(据我所知,它们基本上都是同义词):

        ftps.dir()
        ftps.nlst()
        ftps.retrlines('LIST')
        ftps.retrlines('MLSD')
Run Code Online (Sandbox Code Playgroud)

然后我得到一个异常(下面还包括所有 ftplib 调试信息;通常也与 FileZilla 显示的内容相匹配):

*cmd* 'AUTH TLS'
*put* 'AUTH TLS\r\n'
*get* '234 AUTH TLS OK.\n'
*resp* '234 AUTH TLS OK.'
*cmd* 'USER username@example.com' …
Run Code Online (Sandbox Code Playgroud)

python ftp ftps ftplib python-3.x

5
推荐指数
2
解决办法
1712
查看次数

Unity 的 Mathf.PingPong 实际上是做什么的?

Mathf.PingPong的 Unity 文档说:

PingPongs 值t,因此它永远不会大于length也永远不会小于0

我知道它在 0 和 之间旋转一个值length,我不明白的是这个值t在做什么以及它与 PingPong 的工作方式有什么关系?

如果我设置t为任何常量,我总是会得到那个值

void Update()
{
// always prints: 1
    print(Mathf.PingPong(1f, 1f));

// always prints 0
    print(Mathf.PingPong(0f, 1f));
}
Run Code Online (Sandbox Code Playgroud)

每次我看到在示例中Time.time使用PingPong 时,它都用于t值(或一些基于 的数学Time.time)。为什么?

我看到的唯一解释来自这个问题:c# Unity Mathf.PingPong not working这意味着 的值t必须始终在变化,但同样不清楚为什么或发生了什么。

那么,Mathf.PingPong实际上在做什么t/t实际值是什么,以及如何正确使用该功能?

c# unity-game-engine

4
推荐指数
1
解决办法
1399
查看次数

标签 统计

c# ×1

ftp ×1

ftplib ×1

ftps ×1

python ×1

python-3.x ×1

unity-game-engine ×1