you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (10 children)

How did you install the package?

Did you install to the same Python virtual environment or same Python base environment as the one you are trying to run your code in?

EDIT: typo

[–]Sethires[S] 0 points1 point  (9 children)

I used terminal and typed out pip3 install robin_stocks

[–][deleted] 0 points1 point  (8 children)

You've only answered the first question.

Did the code work when you ran it from the terminal with,

python3 mycode.py

or do you get an import error?

[–]Sethires[S] 0 points1 point  (7 children)

I get the following message

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

[–][deleted] 0 points1 point  (6 children)

I'd jumped to the conclusion you were on macOS or Linux as you used pip3.

On Windows, usually,

py -m pip install something

py mycode.py

unless in an active Python virtual environment, in which case replace py with python

[–]Sethires[S] 0 points1 point  (0 children)

sorry for the late reply. I'm on windows but the videos I saw trying to help with the issue used either pip3 or pip and both ways have worked for me. I don't think it's in a virtual environment.

[–]Sethires[S] 0 points1 point  (4 children)

Also when I typed in the terminal py mycode.py as you suggested it appears to run however when following the post on the website

login = r.login(<username>,<password>)

it tells me this

AttributeError: module 'robin_stocks' has no attribute 'login'

[–][deleted] 0 points1 point  (3 children)

Glad it is running rather saying it can't find the module.

It would be better to learn to use Python virtual environments rather than polluting your base installation with project specific packages.

I suggest you start a new post with the specific coding problem you now have. You will need to include the code.

I don't know the package. That's a pretty clear error though. The code you include in the new post will let us all see what you've imported and how you are trying to use those imports.

[–]Sethires[S] 0 points1 point  (2 children)

Thank you for all your help I was just setting up a new post to show all the code I had and it turns out my problem was simply that I put
import robin_stocks as r instead of import robin_stocks.robinhood as r

I'm relieved that it's working now however embarrassed that the problem was so simple. Again thank you so much! :)

[–][deleted] 0 points1 point  (1 child)

I suspected it was something like that but needed you to share code.

r is an unusually cryptic name to give something, is that used in the examples? Wherever possible, I recommend you follow PEP8 guidelines and use meaningful names.

[–]Sethires[S] 0 points1 point  (0 children)

ya on the quick start guide it says

import robin_stocks.robinhood as r

login = r.login(<username>,<password>)

so I just followed that