ladybug-tools / ladybug-legacy

:beetle: Ladybug is an environmental plugin for Grasshopper.
http://ladybug.tools
Other
195 stars 82 forks source link

Can not download an epw file with the new "Open EPW, STAT files" component on Windows XP #212

Open stgeorges opened 8 years ago

stgeorges commented 8 years ago

Hi @chriswmackey , @mostaphaRoudsari ,

I was wondering if anyone else has been having issues with the latest Open EPW and STAT files component?

I downloaded the newest one, once I noticed this Chris topic (thanks for the information Chris!).

For some reason I can not download any epw file anymore. This is the exception I am getting:

The underlying connection was closed: An unexpected error occurred on a send.

Here is an example definition: open_epw_stat_files.zip A new folder: USA_PA_Philadelphia.Intl.AP.724080_TMY3 gets created, but it's empty with no USA_PA_Philadelphia.Intl.AP.724080_TMY3.zip inside it.

Up until now I have been using an older version 0.0.59 of the component from 01th of February 2015. It worked with no problem. I noticed that it has been using urllib.urlopen method for downloading. This method has been removed since then and replaced with the new System.Net.WebClient().DownloadFile method. Is there a reason for this (I do not know what is causing the issue, or either saying that this is the problem).

I tried turning off my Firewall and my Antivirus, and again the got the same upper exception.

I am using Windows XP SP3, 32 bit Rhino 5 (5.12.50810.13095, 08/10/2015), and Grasshopper 0.9.0075.

Thank you.

chriswmackey commented 8 years ago

@stgeorges ,

Your GH file is running correctly on my system: correctlyrunningdownloadepw I am nearly positive that your issue is related to the fact that the EnergyPlus website of the current climate file database is using secure http (https) while the old website was using normal http. This was the reason why the old urllib.urlopen method had to be replaced with the System.Net.WebClient().DownloadFile method (@mostapharoudsari had to do the same thing for the "Update Ladybug" component when github switched to https).

For some reason, you system seems to be unable to access secure http from background scripts. Can you confirm that using the "Update Ladybug" component like this also fails? updatefromgithub

This might be an issue with Windows XP that I remember you have. Can anyone else who is viewing this thread confirm whether they have experienced this issue?

-Chris

stgeorges commented 8 years ago

Thank you @chriswmackey , Yes, the same upper exception message appears when "Update Ladybug" component is ran. Ok, I will then just pretend that this component will work for other users. I doubt there are much Windows XP users of Ladbybug+Honeybee left.

chriswmackey commented 8 years ago

@stgeorges , It's good that we know the failing piece of code is now. They System library that the WebClient() method lives in is a Microsoft DOT NET library so I can see that it is likely related to using XP instead of newer Windows versions. Let's see if anyone else experiences this issue and we can make a judgement call about if/how we can change it. Also, if you find any code that will get around the https without need for using the System library or this specific method, I imagine that would be grounds for a code change as well. I know it took @mostaphaRoudsari some time to discover the WebClient() workaround, though, so it may be quite the search.

mostaphaRoudsari commented 8 years ago

@stgeorges can you test and see if urllib works on your system with the new link. The issue with urllib is that it's incapable of making secure connections which is needed to download https links. I'm sure there should be a workaround for this issue on Windows XP: https://support.microsoft.com/en-us/kb/314864

stgeorges commented 8 years ago

Hi @chriswmackey , @mostaphaRoudsari ,

Sorry for the late reply.

Chris, on Microsoft WebClient.DownloadFile page, there stands that this method has been introduced since .NET 1.1 version. Windows xp does not support higher than 4.0 .NET version, which is what I have installed. So I guess this method should be included into my windows XP.

Mostapha, yes, the urllib did not work when I ran it with "https" link. This is the exception message I got when ran it with: https://energyplus.net/weather-download/north_and_central_america_wmo_region_4/USA/PA/USA_PA_Philadelphia.Intl.AP.724080_TMY3/all:

System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
   at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`2.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.HandleException(InterpretedFrame frame, Exception exception)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Runtime.PythonFunction.FunctionCaller`2.Default1Call2(CallSite site, CodeContext context, Object func, T0 arg0, T1 arg1)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Runtime.PythonFunction.FunctionCaller`2.Call2(CallSite site, CodeContext context, Object func, T0 arg0, T1 arg1)
   at IronPython.Runtime.Method.MethodBinding`1.SelfTarget(CallSite site, CodeContext context, Object target, T0 arg0)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`6.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`6.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)

I also took a look at the link you gave me. I have my Firewall disabled, and Antivirus too. I have the latest windows XP service pack release: SP3.

I think we can conclude that this issue only happens on Windows XP, and this is it. Probably there are not so many Ladybug+Honeybee users using this operating system. In the end I can just use a regular grasshopper "file path" parameter, instead of Open EPW and STAT files component. So I think it's worth concentrating on some other issues. Eventually me and possibly one more person will simply have to buy a new PC, and switch over to newer Windows version.

Thanks for the support guys.