0

I am trying to run a piece of code using netrc lib in Python. I got examples from the Internet, but they have all failed at the first line.

import netrc

info = netrc.netrc()

Traceback (most recent call last):
  File "./netrc.py", line 2, in <module>
    import netrc
  File "/usr/local/etc/xxx/netrc.py", line 5, in <module>
    info = netrc.netrc()
TypeError: 'module' object is not callable
4

1 回答 1

3

问题是您的脚本文件的名称:netrc.py它与模块名称相同。重命名它。

提供 filename tonetrc.netrc()导致仅使用特定的 netrc 文件代替默认的~\.netrc.

于 2013-04-16T08:03:37.813 回答