I am trying to install and execute the python module yahoo_fin (https://theautomatic.net/yahoo_fin-documentation/). It install apparently fine, but the executable it install is named yahoo-fin.py instead of yahoo_fin.py. And the problem comes when from a program I try to import: if use the installed name, yahoo-fin, the system reject with syntax error (on -), and of course, yahoo_fin does not exist. ¿Someone had a similar problem and/or knows how to resolve it?
Asked
Active
Viewed 87 times
0
-
How did you install it? – ChrisGPT was on strike Apr 16 '22 at 16:09
-
I used: pip install yahoo_fin – RafaBC Apr 18 '22 at 07:28
-
What do you mean by "of course, yahoo_fin does not exist"? Have you tried importing it? – ChrisGPT was on strike Apr 18 '22 at 10:40
-
I mean that installing yahoo_fin, the program installed in my system is named yahoo-fin.py, not yahoo_fin.py as the documentation of the module says. – RafaBC Apr 19 '22 at 09:34
-
Why are you looking at the file name? And are you sure you're looking at the _right_ file? Again, please try importing it as `yahoo_fin` and see what happens. – ChrisGPT was on strike Apr 19 '22 at 11:52
-
I look it because when I use "import yahoo_fin" in a program, I get an error of "the file do not exists", and with "import yahoo-fin", which is the name of the installed program as I explained 2 times, I get the error: "syntax error". But all of that is the origin of the issue as I tried to explain, but excuse me if it is not understood because of my low level in english. – RafaBC Apr 20 '22 at 06:37
-
"The name of the installed program" is not clear, nor is it necessarily relevant. Plenty of Python packages include [entry points](https://stackoverflow.com/q/774824/354577) that you can run, and these don't have to follow Python's module naming rules. That's why I asked you to try importing `yahoo_fin`, to see if there's a module with that name in your Python environment. "the file do not exists" is not an error that you'd get from Python. When sharing error messages, please always copy and paste the _exact_ error message. – ChrisGPT was on strike Apr 20 '22 at 06:40
-
Here you have it. I tried to share a screenshot, but it's not possible. The messages are:import yahoo_fin Traceback (most recent call last): File "/var/folders/62/7w6yk73947l6xct9mm1yzs4r0000gn/T/ipykernel_76622/883860685.py", line 1, in
import yahoo_fin ModuleNotFoundError: No module named 'yahoo_fin' import yahoo-fin File "/var/folders/62/7w6yk73947l6xct9mm1yzs4r0000gn/T/ipykernel_76622/2557157539.py", line 1 import yahoo-fin ^ SyntaxError: invalid syntax – RafaBC Apr 21 '22 at 08:08 -
`import yahoo-fin` will never work, but `import yahoo_fin` should. Are you sure you installed it into the right environment? – ChrisGPT was on strike Apr 21 '22 at 10:49