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

"Import by filename is not supported" when trying to run #49

Closed bdfariello closed 9 years ago

bdfariello commented 9 years ago

I tried running "python -m rfhub" and it failed ("No module named rfhub/")

I found where rfhub was installed, and ran "python -m ./rfhub/" and Python responded with "Relative module names not supported"

Next I ran using the absolute path, and now it responds with "Import by filename is not supported"

Just to be sure, I also echoed $PYTHONPATH and confirmed that this location actually is on my python path (it is).

Any ideas for what I'm doing wrong? I have Python 2.7.8 installed, in case that matters. Does this require 2.7.10?

boakley commented 9 years ago

If you got the message "No module named rfhub/", then you are probably running it as "python -m rfhub/". Note the trailing slash. Please double-check that you aren't including a trailing slash when you specify the module name.

On Mon, Jul 13, 2015 at 4:58 PM, bdfariello notifications@github.com wrote:

I tried running "python -m rfhub" and it failed ("No module named rfhub/")

I found where rfhub was installed, and ran "python -m ./rfhub/" and Python responded with "Relative module names not supported"

Next I ran using the absolute path, and now it responds with "Import by filename is not supported"

Just to be sure, I also echoed $PYTHONPATH and confirmed that this location actually is on my python path (it is).

Any ideas for what I'm doing wrong? I have Python 2.7.8 installed, in case that matters. Does this require 2.7.10?

— Reply to this email directly or view it on GitHub https://github.com/boakley/robotframework-hub/issues/49.

bdfariello commented 9 years ago

Yup, I'm not including a trailing slash anymore. I got past that one and a second error. My current error is "Import by filename is not supported"

Bens-MacBook-Pro-2:site-packages benfariello$ python -m /Library/Python/2.7/site-packages/rfhub /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: Import by filename is not supported.

This is also running on OSX, which is probably obvious at this point :)

boakley commented 9 years ago

Just like the error says, you can't do that. The proper way to start is just like in the documentation says: 'python -m rfhub'. If you do that, and if it is installed properly, I don't think it's possible to get the error you say you do.

--bryan

On Jul 13, 2015, at 6:00 PM, bdfariello notifications@github.com wrote:

Yup, I'm not including a trailing slash anymore. I got past that one and a second error. My current error is "Import by filename is not supported"

Bens-MacBook-Pro-2:site-packages benfariello$ python -m /Library/Python/2.7/site-packages/rfhub /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: Import by filename is not supported.

This is also running on OSX, which is probably obvious at this point :)

— Reply to this email directly or view it on GitHub.

bdfariello commented 9 years ago

I installed via sudo pip install robotframework-hub, and I promise I'm not making it up :) I had tried the exact command from the documentation before trying other alternatives (e.g. trying to use the absolute path).

Bens-MacBook-Pro-2:~ benfariello$ python -m rfhub /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pkg_resources; 'rfhub' is a package and cannot be directly executed

That's why I asked before if this required Python 2.7.10, since it isn't working for me with Python 2.7.8. Or maybe it's platform dependent? I'm on OSX 10.9.5. The last alternative I can think of if there's an unresolved dependency someone, though I thought pip generally took care of dependencies.

If you think it might help, I can also email you the "pip install" output as well.

boakley commented 9 years ago

Well, to be fair, 'rfhub' is a package and cannot be directly executed and No module named pkg_resources are a different problem than you first reported.

rfhub doesn't require python 2.7.10. I use 2.7.8 on a mac for development and it works fine for me. Unfortunately, I can't duplicate your problem.

What happens if you type the following command?

python -c 'import rfhub; print rfhub.__version__'

You should see this as output: 0.8.3. Also, make sure that python --version shows something in the 2.7 series. Also, do you have any files or folders named "rfhub" that might be interfering?

Finally, do you have setuptools installed (pip install setuptools)?

bdfariello commented 9 years ago

Thanks for helping me through this. I probably could have figured it out on my own if I'd started at the beginning of the day, but because it was quittin' time I Googled first. So, for the next guy that Googles first, running that command gave me an import error:

ImportError: No module named pkg_resources

I had setuptools installed already, but I did find a StackOverflow link that suggested I update 'setuptools' and 'distribute' (pip install --upgrade setuptools and pip install --upgrade distribute): http://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

After doing these, everything works as expected and I can now browse to http://127.0.0.1:7070/doc/ as expected. Thanks again!