HYPTUS price lookup problem

Discussions regarding financial software
NeilW
Lemon Slice
Posts: 755
Joined: November 4th, 2016, 4:27 pm

Re: HYPTUS price lookup problem

Post by NeilW »

"Why does the Basic script work on the original URL yet Python now doesn't?"

Well you did ask...

It's all down to how the certificate authorities are accessed by each user of the underlying SSL C code. Likely the libreoffice basic is specifying the correct directory and the embedded python interpreter isn't.

That means basic can verify the Yahoo certificate, but python cannot - so it barfs half way through the redirection process.

Can you tell I've tackled this monster before? I have a wardrobe full of T-shirts...

kiloran
Lemon Quarter
Posts: 3865
Joined: November 4th, 2016, 9:24 am

Re: HYPTUS price lookup problem

Post by kiloran »

NeilW wrote:"Why does the Basic script work on the original URL yet Python now doesn't?"

Well you did ask...

It's all down to how the certificate authorities are accessed by each user of the underlying SSL C code. Likely the libreoffice basic is specifying the correct directory and the embedded python interpreter isn't.

That means basic can verify the Yahoo certificate, but python cannot - so it barfs half way through the redirection process.

Can you tell I've tackled this monster before? I have a wardrobe full of T-shirts...
Ah, yes, well.... so how come the embedded python interpreter quite happily runs the code, but a macro run from within libreoffice fails when using the very same embedded python??

Whoever invented this fancy software lark had no idea of the can of worms he was creating....

--kiloran

kiloran
Lemon Quarter
Posts: 3865
Joined: November 4th, 2016, 9:24 am

Re: HYPTUS price lookup problem

Post by kiloran »

Right..... problem solved.

NeilW deserves a medal for pointing out the redirection of the Yahoo URL. The fix was then very simple, and I've tested it extensively on various versions of LibreOffice and OpenOffice on Windows 7, Windows 10, Linux Mint and Ubuntu. I've also incorporated the fix in other tools such as the StepOne FTSE350, Simple Yahoo Price Scrape and some personal spreadsheets, and they all now work fine.

Version b-c-3.ods is available at: http://lemonfoolfinancialsoftware.weebl ... op-up.html

--kiloran

kiloran
Lemon Quarter
Posts: 3865
Joined: November 4th, 2016, 9:24 am

Re: HYPTUS price lookup problem

Post by kiloran »

I've only just realised that this problem is exactly the same as that reported a month ago by baily56: https://www.lemonfool.co.uk/viewtopic.php?f=27&t=4829

The problem was fixed at the time, so since it's happened again we may be trying to hit a moving target. Having said that, my original fix was very much trial-and-error. I'm rather more hopeful that this time we have a root-cause fix thanks to NeilW

--kiloran

spiderbill
Lemon Slice
Posts: 507
Joined: November 4th, 2016, 9:12 am

Re: HYPTUS price lookup problem

Post by spiderbill »

Rules for dealing with Yahoo:
1. unreliable/missing data at every turn
2. they'll have built their system badly in the first place
3. they'll change it and make it worse

Well done Kiloran for getting a revised version out so quickly (don't have time to test it as I'm up early in the morning to drive to Venice for a flight back to Edinburgh).

Extra credits for NeilW for tracing the redirects.

Bree has clearly sold his soul to the devil :lol:

cheers

Spiderbill

Breelander
Lemon Quarter
Posts: 4108
Joined: November 4th, 2016, 9:42 pm

Re: HYPTUS price lookup problem

Post by Breelander »

kiloran wrote:
Breelander wrote: I'm feeling left out - I can't reproduce this problem whatever I try :(
Win10 15063.332, any version of Libre Office Portable, any HYPTUSS up to and including a freshly downloaded b-c-2.
I can absolutely guarantee that when I release the update, it will work fine for all of us. Except you :D

--kiloran
I'm sorry to report that b-c-3 works fine for me. Was that a money-back guarantee? :D
spiderbill wrote:Bree has clearly sold his soul to the devil :lol:
No, just on loan to Microsoft :twisted:

kiloran
Lemon Quarter
Posts: 3865
Joined: November 4th, 2016, 9:24 am

Re: HYPTUS price lookup problem

Post by kiloran »

Breelander wrote: I'm sorry to report that b-c-3 works fine for me. Was that a money-back guarantee? :D
Curses!
So my bit of code failed:

if user == 'Breelander':
sys.exit()
else:
continue

I'll work on it

--kiloran

UncleEbenezer
Lemon Half
Posts: 9516
Joined: November 4th, 2016, 8:17 pm

Re: HYPTUS price lookup problem

Post by UncleEbenezer »

kiloran wrote: What is addling my brain:
  1. Why does the Basic script work on the original URL yet Python now doesn't?
  2. Why does it work on Linux Mint and Ubuntu, yet not on Windows 7 or Windows 10?
  3. Why did it work when I first tried it on Windows 10, yet failed on the second and subsequent attempts just seconds later?
  4. Why does it work when I run the macro using the Python installation embedded within LibreOffice and OpenOffice, yet fails when I run the macro from within LibreOffice and OpenOffice which uses exactly the same Python?
And that's just for starters. I suspect some form of black magic is involved and it's best not to probe too deeply lest I release some malign spirits.
I expect that black magic is cacheing.

The chain of unconditional requests (as illustrated by NeilW) works. But second time around, you have something in cache. Your system sends a conditional request, and something breaks.

Post Reply

Return to “Financial Software - Discussion”