boakley / robotframework-hub

Web app for accessing robot framework assets
https://github.com/boakley/robotframework-hub/wiki
Apache License 2.0
170 stars 60 forks source link

Module import does not work #66

Closed aaltat closed 8 years ago

aaltat commented 8 years ago

When I start rfhub like this: python -m rfhub --pythonpath C:\path\to\libs --module server.login_page.login.Login. Then I get error: unable to import 'server.login_page.login.Login' : No module named Login

The --pythonpath C:\path\to\libs is same as in my pybot startup script and server.login_page.login.Login is in the same way is I import the library in Robot data. I do not understand why the rfhub is not able to parse the library.

boakley commented 8 years ago

is server.login_page.login.Login a module, or is "Login" a class in the "login" module? In other words, does the file \path\to\libs\server\login_page\login\Login.py exist?

On Wed, Jun 15, 2016 at 8:52 AM, Tatu Aalto notifications@github.com wrote:

When I start rfhub like this: python -m rfhub --pythonpath C:\path\to\libs --module server.login_page.login.Login. Then I get error: unable to import 'server.login_page.login.Login' : No module named Login

The --pythonpath C:\path\to\libs is same as in my pybot startup script and server.login_page.login.Login is in the same way is I import the library in Robot data. I do not understand why the rfhub is not able to parse the library.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/boakley/robotframework-hub/issues/66, or mute the thread https://github.com/notifications/unsubscribe/ABEmYmy1HQDSOHoNRaUjBX_nyb9TdsJuks5qMAOCgaJpZM4I2YPT .

aaltat commented 8 years ago

I am home but I am pretty sure that Login is a class in the login.py file.

aaltat commented 8 years ago

Would solving the problem be easier if there would be an example?

boakley commented 8 years ago

The --module argument, as the name implies, requires a module rather than a class. Try it with '--module server.login_page.login'. It should then find all classes in that module.

On Wed, Jun 15, 2016 at 10:13 AM, Tatu Aalto notifications@github.com wrote:

I am home but I am pretty sure that Login is a class in the login.py file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/boakley/robotframework-hub/issues/66#issuecomment-226218847, or mute the thread https://github.com/notifications/unsubscribe/ABEmYioVvr9a4avl-mL3NiihmbaSBQbRks5qMBaOgaJpZM4I2YPT .

aaltat commented 8 years ago

And if the module contains many classes but it should find only a one class, the Login. Then I should give the command like: python -m rfhub --pythonpath C:\path\to\libs --module server.login_page.login Login

boakley commented 8 years ago

No, --module means "find all the classes in this module". It's primarily designed for a module that defines page objects, or a module that defines several collections of keywords.

If you want only a specific class, use "--library server.login_page.login.Login".

On Wed, Jun 15, 2016 at 11:07 AM, Tatu Aalto notifications@github.com wrote:

And if the module contains many classes but it should find only a one class, the Login. Then I should give the command like: python -m rfhub --pythonpath C:\path\to\libs --module server.login_page.login Login

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/boakley/robotframework-hub/issues/66#issuecomment-226236682, or mute the thread https://github.com/notifications/unsubscribe/ABEmYkWrGKljMGtefTZKHO4QWxvrHafkks5qMCNUgaJpZM4I2YPT .

aaltat commented 8 years ago

Ah ok, thanks for info

aaltat commented 8 years ago

Tried and works like a charm. Thanks from input.

boakley commented 8 years ago

Thanks for using the hub! I hope you're finding it helpful. I wish I had more time to make it better :-\

On Thu, Jun 16, 2016 at 8:42 AM, Tatu Aalto notifications@github.com wrote:

Tried and works like a charm. Thanks from input.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/boakley/robotframework-hub/issues/66#issuecomment-226488371, or mute the thread https://github.com/notifications/unsubscribe/ABEmYpbIl83b87waqE4DJvogG1Y59hy5ks5qMVK-gaJpZM4I2YPT .

aaltat commented 8 years ago

It is really useful, it makes finding the keywords so easy. Keep up the good work.