Rod-Persky / investoscope-easy-update

Updates Investoscope 3 end of day quotes
GNU General Public License v3.0
6 stars 3 forks source link

Notes on installing on Catalina #21

Open charlietomo opened 4 years ago

charlietomo commented 4 years ago

I just setup a new Macbook Pro, running Catalina 10.15.7 and getting Investoscope 3 and Investoscope Update to work was not as straightforward as I had hoped. Leaving some notes here in case it is useful for someone.

  1. Investoscope 3 is not available in the app store any more, even in my "Purchased" list. I transferred the .app from a backup, put it into my Applications folder and then when running it had to authenticate with my Apple credentials (of the account I originally bought Investoscope with). Then it runs. I seem unable to change the default location for where data is store (which is annoying) - I get an error message; any help here appreciated. Error is "Invalid data folder / The selected folder is on a disk that is not suitable for user data".
  2. It is possible to import holdings from a backup, so you have instruments and holdings. This will not include historical data.
  3. Download Investoscope updater and edit line 6 of investoscope.py to include the correct path to the data folder. This was harder to find than expected. I managed to find mine at /Users/[username]/Library/Containers/com.investoscope.Investoscope3/Data/Library/Application Support/Investoscope 3
  4. Install requirements for Investoscope Updater, this is at least sudo pip3 install requests (I did this over a little while and can't remember if there was anything else).
  5. Update line 3 of script to usr/bin/python3 which reflects the location of Python3 on Catalina.
  6. Run Investoscope Updater - it should now run and update instruments :-)

I am getting a couple of errors and my coding skills are not yet up to fixing them:

​/private/var/folders/37/vzx7pkfs76s5447sgvn0j9c00000gn/T/AppTranslocation/91E0BB27-CB3A-4D4E-A5DD-4B3F419B796E/d/Investoscope Updater.app/Contents/Resources/investoscope.py:57: SyntaxWarning: "is not" with a literal. Did you mean "!="? if process.returncode is not 0:

and

/private/var/folders/37/vzx7pkfs76s5447sgvn0j9c00000gn/T/AppTranslocation/91E0BB27-CB3A-4C4E-A5DD-4B3F417B796E/d/Investoscope Updater.app/Contents/Resources/qapi.py:59: SyntaxWarning: "is not" with a literal. Did you mean "!="? if len(code_market) is not 2:

I also see some of these but this may be linked to instruments

An exception of type AttributeError occurred. Arguments: ("'NoneType' object has no attribute 'group'",)

I am testing out some alternatives to Investoscope but nothing is as good yet :-(

Kusine commented 3 years ago

@charlietomo thank you for your steps, they were helpful. Unfortunately I still get an error message (see below) after following your steps: "no such file or directory exists". I also get a similar /private/var/folders/... error message like the one you mentioned.

Like you I have looked around for alternative applications but have not yet found anything as good as Investoscope. I have kind of given up... 😢 I was hopeful when I stumbled on this updater but it does not seem to work.

Screen Shot 2021-02-07 at 20 55 29

charlietomo commented 3 years ago

Sorry the instructions didn't result in success. It looks like it may "just" be a Python or permissions issue. What OS are you running? I found the online tool Sharesight, which has some nice features but also some missing features for me, and comes with a reasonable annual licensing cost.

Kusine commented 3 years ago

Hi @charlietomo I am running 10.15.7. Thanks for pointing out Sharesight. It looks nice (unlike many of the PC port solutions out there). It does seem rather expensive for an application missing features. I also dislike subscription models. However, I shall take a look. For now I am using Investoscope just to login transactions and have the reports. I do miss the updating of stock prices.

charlietomo commented 3 years ago

Hmm, 10.15.7 is the same as me so it isn't a Big Sur issue. I also dislike subscription models but that is the way things are moving. There are some good features, including sharing with others and weekly email reports showing portfolio performance. I have not found a good way to move long term historical records from Investoscope > Sharesight.

Kusine commented 3 years ago

Hi @charlietomo - noted regarding Sharesight, I will explore more closely. Thanks again!

KhaineBOT commented 3 years ago

You need to install python3 from home-brew or macports, or from the python website. MacOS only comes with python2. This is why you are running into errors

charlietomo commented 3 years ago

You need to install python3 from home-brew or macports, or from the python website. MacOS only comes with python2. This is why you are running into errors

Interesting, and apologies I missed this step out. It appears I already have both python@3.8 and python@3.9 as installed via brew and shown from brew list. They must have been dependencies from something else.

KhaineBOT commented 3 years ago

Did changing the reference to python3 to the brew installed version (typically at /usr/local/bin/python3) solve your problem?

Kusine commented 3 years ago

Hi @KhaineBOT thank you for your suggestion. I already had Python 3.8 and 3.9 installed on my Mac via Homebrew. When I list the contents of /usr/local/bin/I see the following:

ls content

Can you help guide me on how ensure that the reference to python3 points indeed to the brew installed version? Is it via the .bash_profile? Thank you.

Kusine commented 3 years ago

Interesting, and apologies I missed this step out. It appears I already have both python@3.8 and python@3.9 as installed via brew and shown from brew list.

Hi @charlietomo - me too, when I brew list I see both python@3.8 and python@3.9.

KhaineBOT commented 3 years ago

In the script file you should make sure the line is the following:

PYTHON="/usr/local/bin/python3"

Kusine commented 3 years ago

Hi @KhaineBOT in Investoscope Updater > Show Package Contents > Contents > Resources > Script I have changed the 3rd line to: PYTHON="/usr/local/bin/python3"

I get the following message: no file or dir

KhaineBOT commented 3 years ago

What is the output of:

which python3

I get /usr/local/bin/python3 on my system where I have installed python3 using brew. You will need to find where your instance of python3 is installed and use that, or look into why brew didn't install python correctly

Kusine commented 3 years ago

Hello @KhaineBOT the output of which python3 is: /usr/local/bin/python3

When I simply type python3, I get the following output: Python 3.9.2 (default, Feb 24 2021, 13:30:36) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information.

It seems like python3 was properly installed by brew? Thank you for your help with this.

KhaineBOT commented 3 years ago

Your screenshot shows that the path you have entered is usr/local/bin/python3. It should be /usr/local/bin/python3

Kusine commented 3 years ago

​Hi @KhaineBOT thank you for catching that. I made the necessary changes and tried again. I unfortunately got the following error message:

FileNotFoundError[Errno 2] No such file or directory:`/Users/username/.investoscope...`

/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/6BC5004D-AD73-4C04-8FD8-0BCB526BFF3F/d/Investoscope Updater.app/Contents/Resources/investoscope.py:57: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if process.returncode is not 0:
Traceback (most recent call last):
  File "/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/6BC5004D-AD73-4C04-8FD8-0BCB526BFF3F/d/Investoscope Updater.app/Contents/Resources/update.py", line 7, in <module>
    import investoscope
  File "/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/6BC5004D-AD73-4C04-8FD8-0BCB526BFF3F/d/Investoscope Updater.app/Contents/Resources/investoscope.py", line 23, in <module>
    CSV_DOWNLOAD_PATH.mkdir(exist_ok=True)
  File "/usr/local/Cellar/python@3.9/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1312, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/username/.investoscope/csv_data'
KhaineBOT commented 3 years ago

It is complaining that the file does not exist. This is because you have not referenced the correct path in your step 3:

3: Download Investoscope updater and edit line 6 of investoscope.py to include the correct path to the data folder. This was harder to find than expected. I managed to find mine at /Users/[username]/Library/Containers/com.investoscope.Investoscope3/Data/Library/Application Support/Investoscope 3

You need to put your username in the path, rather than [username]. This should be the name you use to login to macOS (which is the name of your home directory). For me, its:

/Users/KhaineBOT/Library/Containers/com.investoscope.Investoscope3/Data/Library/Application Support/Investoscope 3

Kusine commented 3 years ago

When I checked line 6 of my investoscope.py the following was already present: INVESTOSCOPE_DB = "/Users/myusername/Library/Containers/com.investoscope.Investoscope3/Data/Library/Application Support/Investoscope 3"

KhaineBOT commented 3 years ago

You edited the wrong variable. You need to change the path, not the db name. Try the following:

INVESTOSCOPE_PATH = "~/Library/Containers/com.investoscope.Investoscope3/Data/Library/Application Support/Investoscope 3/" INVESTOSCOPE_DB = "data4.issqlite"

Kusine commented 3 years ago

Thank you @KhaineBOT for pointing that out and apologies for my mistake. Just FYI, in my investoscope.py, INVESTOSCOPE_PATH is on line 5...

Anyway, I made the changes following your guidance, saved the file and tried the updater again. Unfortunately this time I received a different error message:

ModuleNotFoundError: No module named 'requests'
/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/DFBF543A-79AC-45E3-BC3A-89621CC76794/d/Investoscope Updater.app/Contents/Resources/investoscope.py:57: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if process.returncode is not 0:
/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/DFBF543A-79AC-45E3-BC3A-89621CC76794/d/Investoscope Updater.app/Contents/Resources/qapi.py:59: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(code_market) is not 2:
Traceback (most recent call last):
  File "/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/DFBF543A-79AC-45E3-BC3A-89621CC76794/d/Investoscope Updater.app/Contents/Resources/update.py", line 8, in <module>
    import qapi
  File "/private/var/folders/th/n3s3wtg507vbvcb1t_wfsn6r0000gn/T/AppTranslocation/DFBF543A-79AC-45E3-BC3A-89621CC76794/d/Investoscope Updater.app/Contents/Resources/qapi.py", line 18, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Thank you for your patience and your help.

KhaineBOT commented 3 years ago

You need to install the requests module for python.

On the command line run:

pip3 install requests

Kusine commented 3 years ago

@KhaineBOT, that did it! Thank you so much!

Wow, it's wonderful to have Investoscope working again - I have been waiting for years!

Just a final quick question, will Investoscope now update daily / realtime stock prices or do I have to open the updater to update the prices? Once again thank you so much!

KhaineBOT commented 3 years ago

You need to run the updater to update the prices. The way it works is it downloads the prices from yahoo finance and then using AppleScript manually updates the prices in investoscope.

Kusine commented 3 years ago

I see - thank you for clarifying. So I will then keep the updater close at hand. Thanks again for your help, I greatly appreciate it!

Kusine commented 1 year ago

Hi @KhaineBOT, during my recent attempts at updating Investoscope stock quotes via the Investoscope Updater, I get the following messages for each ticker: "'NoneType' object has no attribute 'group'"(see screenshot).

Although the blue progress bar stays in its initial position, the updater proceeds through all the tickers and provides the same message for each ticker. After a certain amount of time, I presume after all tickers have been checked, it simply quits itself.

I have gone through your previous advice and guidance and everything seems in order.

The only change I have done since 2021 is that I installed Python via pyenv and so I have changed the following from: PYTHON="/usr/local/bin/python3" to: PYTHON="/Users/username/.pyenv/shims/python" -- I hope that I did not make any mistake here.

Could you please help with this issue? What can I do to fix this. Thank you in advance.

Screenshot 2023-02-27 at 14 51 04
KhaineBOT commented 1 year ago

I get that as well. I haven't looked too much into it, as all of my stock codes still work. I assume it is that yahoo finance does not have any data on the various instruments, or they are for instruments that don't currently work in the updater. For example, I know that indices are broken.

Kusine commented 1 year ago

Hi @KhaineBOT thank you for your helpful reply. Yahoo should have info on those instruments as they are popular tickers in the US market and in the past they were updated by the updater. Do you think this has something to do with my deleting Python that was previously installed via brew to Python via pyenv? Thank you.