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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

3

The problem is the name of your script file: netrc.py which is the same as the module name. Rename it.

Providing filename to netrc.netrc() causes only to use the specific netrc file in place of the default ~\.netrc.

SePo
  • 31
  • 1