1

I am having trouble with Pyro 4 in Windows 10.

I installed Pyro4 via pip.

I open cmd and type py.

I type: import Pyro4.

I type: Pyro4.naming.

I get back AttributeError: module 'Pyro4' has no attribute 'naming'.

I type: help(Pyro4).

naming is listed in the package contents.

Justin Giboney
  • 3,271
  • 2
  • 19
  • 18
  • "package contents" does not equal "module contents". You need to ``import Pyro4.naming`` to access that module, see DYZ answer below. This is basic Python import logic btw, it has nothing to do with Pyro as such. – Irmen de Jong May 01 '17 at 18:19

2 Answers2

4

naming is a module and a part of the package Pyro4. It has to be imported separately:

import Pyro4.naming

Or:

import Pyro4.naming as naming
DYZ
  • 55,249
  • 10
  • 64
  • 93
  • or `from Pyro4 import naming` – matusko Apr 30 '17 at 21:52
  • Actually it is imported with `import Pyro4`, see my answer bellow. – matusko Apr 30 '17 at 21:54
  • 1
    Since a few versions ago Pyro4 (the top level package) no longer imports anything from the Pyro4.naming package. It gets all it needs from Pyro4.core, mostly. Before that, it did import a few things from the naming sub package but it never import the full module. That is why you have to import it in your own code if you need to use things from it, if you only have imported Pyro4 before. (This is all basic Python import logic btw, it has nothing to do with Pyro as such.) – Irmen de Jong May 01 '17 at 18:18
1

Since naming is a module you cant just call it.

help(Pyro4.naming)

proves it is loaded module and it is working. You can access classes or functions in naming as

Pyro4.naming.AutoCleaner(...)
matusko
  • 3,487
  • 3
  • 20
  • 31