HYPTUS v11.31 Run-time error 5
-
- Lemon Pip
- Posts: 80
- Joined: November 4th, 2016, 3:03 pm
Re: HYPTUS v11.31 Run-time error 5
Thankyou very much Itsallaguess for the new beta version.
I have it up & running perfectly after a couple of trys!!
Best regards,
Biffinsbridge.
I have it up & running perfectly after a couple of trys!!
Best regards,
Biffinsbridge.
-
- Lemon Slice
- Posts: 755
- Joined: November 4th, 2016, 4:27 pm
Re: HYPTUS v11.31 Run-time error 5
Perhaps the easiest way around this is to catch the exception if it occurs and retry with an unverified context, so that only broken CA cert databases proceed unverified.
https://www.python.org/dev/peps/pep-047 ... patibility
https://www.python.org/dev/peps/pep-047 ... patibility
-
- Lemon Slice
- Posts: 755
- Joined: November 4th, 2016, 4:27 pm
Re: HYPTUS v11.31 Run-time error 5
From the HYPTUSS log file which I was about to mail, but I'll paste here.kiloran wrote: Where are you seeing this, Neil? I'm not sure which message you are replying to. It does sound rather like the bug I reported to LibreOffice. I have a work-around for Windows, don't know if it might apply to a Mac
17:37:48 Line: 602 getHtml started for url https://query1.finance.yahoo.com/v7/fin ... EUR=X,BP.L 17:37:48 Line: 617 Starting attempt 1 webTimeOut = 10 17:37:48 Line: 659 Exception e = <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)> 17:37:48 Line: 617 Starting attempt 2 webTimeOut = 20 17:37:48 Line: 659 Exception e = <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)> 17:37:48 Line: 617 Starting attempt 3 webTimeOut = 40 17:37:48 Line: 659 Exception e = <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)> 17:37:48 Line: 617 Starting attempt 4 webTimeOut = 80 17:37:48 Line: 659 Exception e = <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)> 17:37:48 Line: 617 Starting attempt 5 webTimeOut = 160 17:37:48 Line: 659 Exception e = <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:719)>
-
- Lemon Half
- Posts: 6209
- Joined: November 4th, 2016, 11:24 am
Re: HYPTUS v11.31 Run-time error 5
In both my Excel VB code and my Perl scripts I'm using just plain http://query1.finance.yahoo.com/v7/etc and it's all working fine so you might well be able to avoid any SSL issues by simply not using SSL (https)....
-
- Posts: 28
- Joined: November 10th, 2016, 12:49 am
Re: HYPTUS v11.31 Run-time error 5
Marvellous...NeilW wrote:Perhaps the easiest way around this is to catch the exception if it occurs and retry with an unverified context, so that only broken CA cert databases proceed unverified.
1. Sometimes I'm glad I don't do this lark for a living...
![Smile :)](./images/smilies/icon_e_smile.gif)
2. Kiloran - you've regressed the (downstream of this) bug in createPriceDict() lines 680/686, data used before initialisation (when the re.search fails to match). It'll bite again one day!
desmid
-
- Lemon Slice
- Posts: 755
- Joined: November 4th, 2016, 4:27 pm
Re: HYPTUS v11.31 Run-time error 5
Looks like the http request is indeed being answered directly rather than via a redirect to the SSL url. So that would solve the issue and we get to kick the can until they make SSL compulsory ![Smile :-)](./images/smilies/icon_e_smile.gif)
![Smile :-)](./images/smilies/icon_e_smile.gif)
$ curl -v http://query1.finance.yahoo.com/v7/fina ... FTSE,^FTAS * Trying 87.248.114.12... * Connected to query1.finance.yahoo.com (87.248.114.12) port 80 (#0) > GET /v7/finance/quote?symbols=^FTSE,^FTAS HTTP/1.1 > Host: query1.finance.yahoo.com > User-Agent: curl/7.47.0 > Accept: */* > < HTTP/1.1 200 OK < X-Content-Type-Options: nosniff < X-Yahoo-Request-Id: cf9has9d0it9c < Cache-Control: max-age=1, stale-while-revalidate=15 < Content-Type: application/json; charset=utf-8 < Vary: Origin < Content-Length: 2502 < Date: Mon, 13 Nov 2017 10:34:20 GMT < Age: 0 ...
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
Many thanks to NeilW and mike for runing the b-f-dev3 version and providing the logfile results. This looks for all the world like the LibreOffice bug (and apparently OpenOffice also) that I uncovered a few months ago when I was rebuilding the Week Ahead functionality.
When LibreOffice sees an https url, it calls an SSL library, and it should use the SSL library installed with LibreOffice. Due to the bug, LibreOffice may find another SSL library installed by other software or by a LibreOffice extension, instead of the built-in LibreOffice SSL library.
In the case of Yahoo, as pointed out by mc2fool and NeilW, it looks like we can replace the https url with an http url and therefore bypass the bug (this wasn't possible with the Week Ahead stuff, I seem to remember). I'll look at this later today and hopefully publish an updated version.
You may find that you can get around the bug by running LibreOffice in Safe Mode (I don't think OpenOffice has a Safe Mode):
--kiloran
When LibreOffice sees an https url, it calls an SSL library, and it should use the SSL library installed with LibreOffice. Due to the bug, LibreOffice may find another SSL library installed by other software or by a LibreOffice extension, instead of the built-in LibreOffice SSL library.
In the case of Yahoo, as pointed out by mc2fool and NeilW, it looks like we can replace the https url with an http url and therefore bypass the bug (this wasn't possible with the Week Ahead stuff, I seem to remember). I'll look at this later today and hopefully publish an updated version.
You may find that you can get around the bug by running LibreOffice in Safe Mode (I don't think OpenOffice has a Safe Mode):
- Open LibreOffice Calc (a new document, not HYPTUSS)
- "HELP/RESTART IN SAFE MODE", then Restart
- When the new window pops up, click "Continue in Safe Mode"
- You will get a new Calc document, but macros will be disabled.
- "TOOLS/OPTIONS/LIBREOFFICE/SECURITY/MACRO SECURITY" ... set to medium
- "FILE/OPEN" and select your HYPTUSS
- Run the Yahoo Price Update and let us know if it now works
--kiloran
-
- Lemon Quarter
- Posts: 4108
- Joined: November 4th, 2016, 9:42 pm
Re: HYPTUS v11.31 Run-time error 5
...that may also explain why I don't see the bug - I use LibreOffice Portable, it's not installed as such, so it's unlikely to see 'other installed software'.kiloran wrote:...This looks for all the world like the LibreOffice bug (and apparently OpenOffice also) that I uncovered a few months ago when I was rebuilding the Week Ahead functionality.
When LibreOffice sees an https url, it calls an SSL library, and it should use the SSL library installed with LibreOffice. Due to the bug, LibreOffice may find another SSL library installed by other software or by a LibreOffice extension, instead of the built-in LibreOffice SSL library...
-
- Posts: 29
- Joined: November 17th, 2016, 7:48 pm
Re: HYPTUS v11.31 Run-time error 5
Dear Kiloran
re yohyr instructions
To change the macro level on MAC it is under Preferences, Security in the Libreoffice menu not the tools menu
Unfortunately that still does not work giving the same error when trying to download the prices
Regards
Colin
re yohyr instructions
To change the macro level on MAC it is under Preferences, Security in the Libreoffice menu not the tools menu
Unfortunately that still does not work giving the same error when trying to download the prices
Regards
Colin
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
Yes, that's understandable, Colin. When updating Forecasts, it tries to grab FTSE index values from Yahoo and update the tracking sheet. It's the same problem as updating Yahoo prices.Whatsup wrote:interestingly having tried to update forecasts yields it does it but at he end of the procedure gives the following message
com.sun.star.uno.RuntimeException: Error during invoking function HypFcstYldPy in module vnd.sun.star.tdoc:/1/Scripts/python/HypTopUp.py (<class 'UnboundLocalError'>: local variable 'data' referenced before assignment
File "/Applications/LibreOffice.app/Contents/Resources/pythonscript.py", line 875, in invoke
ret = self.func( *args )
File "vnd.sun.star.tdoc:/1/Scripts/python/HypTopUp.py", line 1148, in HypFcstYldPy
File "vnd.sun.star.tdoc:/1/Scripts/python/HypTopUp.py", line 1292, in HypFcstYldPy_1
File "vnd.sun.star.tdoc:/1/Scripts/python/HypTopUp.py", line 522, in writeTrackData
File "vnd.sun.star.tdoc:/1/Scripts/python/HypTopUp.py", line 660, in createPriceDict
)
Regards
Colin
--kiloran
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
I've vaguely pondered this in the past, and following eventide's brilliant work, I definitely want to have a look at this in an idle moment. But right now, there are NO idle moments, not even an idle microsecond. Maybe one to look at when I can no longer stand the rubbish on the telly at christmas!gbalin wrote:As ever, in awe of all your work and expertise. Bear with me if this is a stupid question, but is there a similar add-on/plugin for LibreOFfice?Itsallaguess wrote: Hi GN100,
If you download eventide's 'GETDATA' add-in for Excel from here -
https://www.lemonfool.co.uk/viewtopic.p ... 190#p93095
GB
--kiloran
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
I'll ponder that at some point, though I'm not convinced by the benefits. If you do want to play with the code, this is my modus operandi (on Windows 7)NeilW wrote:Any chance of getting the scripts and the tests in a Github repo outside the spreadsheet? Getting to the scripts is turning into a right pain. There is no edit function for python scripts in the Organise Macros dialog - even with the Java JDK installed. So I'm looking at having to rip apart the ODS file.
- open the HYPTUSS as an archive (I use 7-zip), navigate to Scripts/python and extract HypTopUp.py to folder X on your desktop (see below). Close the archive
- Edit HypTopUp.py using your favourite text editor and save the changes (no need to close)
- Open HYPTUSS, then TOOLS/MACROS/RUN MACROS. Expand My Macros, and you should see HypTopUp. Click on this, then run the macro you want
- When you are happy, open the HYPTUSS as an archive again, and replace the HypTopUp.py in the archive with your desktop copy. DO NOT CHANGE THE NAME. HypTopUp.py and it's case-sensitive
- Close the archive and you are good to go
Personally, in step 4, I drag the renamed version into the archive, delete the HypTopUp.py in the archive, then rename the new file.
Location for Folder X:
On windows, this is C:\Users\YourAccount\AppData\Roaming\LibreOffice\4\user\Scripts\python
You may have to create the \Scripts\python folder, and it is CASE SENSITIVE
I'm sure a bit of Googling will reveal the equivalent location for a Mac or Linux
--kiloran
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
Not sure what you mean, desmid, I haven't changed this bit of code.desmid wrote:
2. Kiloran - you've regressed the (downstream of this) bug in createPriceDict() lines 680/686, data used before initialisation (when the re.search fails to match). It'll bite again one day!
desmid
Perhaps you are referring to the change you suggested in createPriceDict, if the regex fails so data is not initialised. In which, I'm working on it. As I mentioned, the original code was published in a real rush and I had no time to add any error trapping and suchlike.
Hopefully I'll have a new update later today which resolves this
--kiloran
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
The portable versions aren't immune to the problems, Bree. I normally use the desktop version of LibreOffice, but I also have many versions in portable format (and also OpenOffice portable). When I first encountered the bug, the portable versions also exhibited the problem. Various flavours of LO 5 failed, all of the LO 4 versions were OK.Breelander wrote:...that may also explain why I don't see the bug - I use LibreOffice Portable, it's not installed as such, so it's unlikely to see 'other installed software'.kiloran wrote:...This looks for all the world like the LibreOffice bug (and apparently OpenOffice also) that I uncovered a few months ago when I was rebuilding the Week Ahead functionality.
When LibreOffice sees an https url, it calls an SSL library, and it should use the SSL library installed with LibreOffice. Due to the bug, LibreOffice may find another SSL library installed by other software or by a LibreOffice extension, instead of the built-in LibreOffice SSL library...
It seems to be other bits of software on a PC which reveals the bug, which explains why some people see the bug and others don't
--kiloran
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
HYPTUSS new LibreOffice and OpenOffice version
I've published a new version for LibreOffice/OpenOffice (LO/OO)... Hyp Top-Up Version-b-f-dev4.ods
It's available at: http://lemonfoolfinancialsoftware.weebl ... _page.html.
I've changed the URLs for price retrieval from Yahoo, from https to http. It does seem to me that the SSL problem with LO/OO has not been fixed, but this may be an acceptable workaround. I've also implemented more error trapping so if there is a problem, there should be a soft landing rather than throwing all of its toys out of the pram and collapsing in an ungainly heap.
For those of you with ongoing problems, can you please test it and report back? For the rest of you, there have been no fundamental changes, but if you have the time it would be good if you could test it anyway to make sure I haven't broken anything else.
I still haven't managed to read and understand all that desmid has written (apologies!) but I have all the posts on my to-do list, I suspect I can learn a lot from you.
--kiloran
It's available at: http://lemonfoolfinancialsoftware.weebl ... _page.html.
I've changed the URLs for price retrieval from Yahoo, from https to http. It does seem to me that the SSL problem with LO/OO has not been fixed, but this may be an acceptable workaround. I've also implemented more error trapping so if there is a problem, there should be a soft landing rather than throwing all of its toys out of the pram and collapsing in an ungainly heap.
For those of you with ongoing problems, can you please test it and report back? For the rest of you, there have been no fundamental changes, but if you have the time it would be good if you could test it anyway to make sure I haven't broken anything else.
I still haven't managed to read and understand all that desmid has written (apologies!) but I have all the posts on my to-do list, I suspect I can learn a lot from you.
--kiloran
-
- Lemon Quarter
- Posts: 2169
- Joined: November 4th, 2016, 11:21 am
Re: HYPTUS v11.31 Run-time error 5
Kiloran, brings in the prices in the latest still version of Libreoffice, no error messages here. Cheers!
-
- Lemon Quarter
- Posts: 3865
- Joined: November 4th, 2016, 9:24 am
Re: HYPTUS v11.31 Run-time error 5
My memory fails me, and I don't have time to go through all the previous posts..... did it work for you previously, or has this fixed your problem?JMN2 wrote:Kiloran, brings in the prices in the latest still version of Libreoffice, no error messages here. Cheers!
--kiloran
-
- Posts: 28
- Joined: November 10th, 2016, 12:49 am
Re: HYPTUS v11.31 Run-time error 5
[EDIT: I just saw you made the change in b-f-dev4 - great! - still, the following might be useful, or not for some.]kiloran wrote:Not sure what you mean, desmid, I haven't changed this bit of code.desmid wrote:
2. Kiloran - you've regressed the (downstream of this) bug in createPriceDict() lines 680/686, data used before initialisation (when the re.search fails to match). It'll bite again one day!
desmid
Perhaps you are referring to the change you suggested in createPriceDict, if the regex fails so data is not initialised. In which, I'm working on it. As I mentioned, the original code was published in a real rush and I had no time to add any error trapping and suchlike.
Hopefully I'll have a new update later today which resolves this
--kiloran
I think there's a misunderstanding. It's not intended to be critical, and apologies if I sound that way. I'm tremendously grateful for your work on all this and your SimpleYahooPriceScape was the intro I needed to get started on my own spreadsheets. Do you know, I'd no idea how even to add a button to a spreadsheet? - never even done it before.
The issue with the uninitialised variable is just a (common, everyone does it, I do it) syntax error in that routine. The variable 'data' is used in the loop, but it only comes into existence if the regular expression matches in one side of a branch:
Code: Select all
matchObj = re.search( r'.*?\[(.*?)\].*', html)
#data = '' #initialise in case re.search fails
if matchObj:
data = matchObj.group(1)
while data:
do stuff with data
Why does Python behave this way? Not sure - I'm just reading this at the mo': https://eli.thegreenplace.net/2011/05/1 ... -in-python
Ideally createPriceDict should receive valid data - that seems to be your angle - quite right!
![Smile :)](./images/smilies/icon_e_smile.gif)
Again, HYPTUSS is great - thank you for making it.
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Also, sorry for being so long-winded.
desmid
Last edited by desmid on November 14th, 2017, 4:37 pm, edited 1 time in total.
-
- Lemon Quarter
- Posts: 2169
- Joined: November 4th, 2016, 11:21 am
Re: HYPTUS v11.31 Run-time error 5
Did not work for me previously. Prices and yields work now.kiloran wrote:My memory fails me, and I don't have time to go through all the previous posts..... did it work for you previously, or has this fixed your problem?JMN2 wrote:Kiloran, brings in the prices in the latest still version of Libreoffice, no error messages here. Cheers!
--kiloran
-
- Posts: 28
- Joined: November 10th, 2016, 12:49 am
Re: HYPTUSS new LibreOffice and OpenOffice version
Likewise - quite apart from all the HYP knowledge, I just looked into the Excel version using 'oletools' to dump out the VBA - I've never seen it before and wouldn't know where to begin. It's quite a feat writing and maintaining two versions of a program in utterly different languages - hats off!kiloran wrote: ...
I still haven't managed to read and understand all that desmid has written (apologies!) but I have all the posts on my to-do list, I suspect I can learn a lot from you.
--kiloran
When I posted about logging, I'd not at that point noticed you'd already built some infrastructure to do that. My suggestion was to use the built-in 'logging' module, which is just as standard a python component as, say 'os' or 'sys' or 're' and one wouldn't normally want to re-implement those.
Similarly, 'unittest' is standard, batteries included, and all the kids these days use that.
![Smile :)](./images/smilies/icon_e_smile.gif)
My two penn'orth
desmid