Re: A5_DownLoadFile() revisited
It helps to read the Help file. In this case, I won't apologize for not looking at it sooner because apparently nobody else did either. I was looking at this command for a different reason than this thread and got very frustrated with the command. However, after reading the Help file I believe I have PART of the solution. The rest will be submitted as a bug report.
The Help file points out that the HTTP_Download() command has a "modal" argument. In all the examples here, it was set to .F. and nobody thought about it. This needs to be set to True (.T.) if you want to use it in a loop. Without that, the script will continue before the file is downloaded. However, the A5_DownLoadFile() command (which I suspect is just a wrapper for the HTTP_Download() function) is "modal" by default. In fact, there is no way to turn off "modal" in the A5_DownLoadFile() function.
So, there was a "timing" issue of our own making when using the HTTP_Download() function but there is not a timing issue when using the A5_DownLoadFile() function.
The original question about the "not an open table" issue seems to be a bug. If I test this using a crlf() string to hold the names of the files to be downloaded, it works like a champ. Whenever I use a table, the table gets closed by whichever function is used - the HTTP_Download() function or the A5_DownLoadFile() function.
FWIW, I've decided that these two functions, Http_download() and A5_DownLoadFile(), are now in my "scary to use" category.
My "scary to use" category is defined as any function that works in some cases but, for no apparent reason, does not work in others.
After quite a bit of testing I've discovered that these commands will download almost any kind of file from some websites but don't seem to work at all on other websites. The real problem is that I don't know why they don't work on certain websites. If I did, then I could probably take them out of the "scary to use" category.
The test app I'm sending with my bug report is attached in case anyone else wants to try it. (The files to be downloaded by my test routines are on my website and will be there for at least a month. No guarantees after that. I purposely picked small files so they won't take long to download even on a phone modem.)
I also included my "scary to use" comments in the bug report so hopefully we can get some clarification on that as well.
It helps to read the Help file. In this case, I won't apologize for not looking at it sooner because apparently nobody else did either. I was looking at this command for a different reason than this thread and got very frustrated with the command. However, after reading the Help file I believe I have PART of the solution. The rest will be submitted as a bug report.
The Help file points out that the HTTP_Download() command has a "modal" argument. In all the examples here, it was set to .F. and nobody thought about it. This needs to be set to True (.T.) if you want to use it in a loop. Without that, the script will continue before the file is downloaded. However, the A5_DownLoadFile() command (which I suspect is just a wrapper for the HTTP_Download() function) is "modal" by default. In fact, there is no way to turn off "modal" in the A5_DownLoadFile() function.
So, there was a "timing" issue of our own making when using the HTTP_Download() function but there is not a timing issue when using the A5_DownLoadFile() function.
The original question about the "not an open table" issue seems to be a bug. If I test this using a crlf() string to hold the names of the files to be downloaded, it works like a champ. Whenever I use a table, the table gets closed by whichever function is used - the HTTP_Download() function or the A5_DownLoadFile() function.
FWIW, I've decided that these two functions, Http_download() and A5_DownLoadFile(), are now in my "scary to use" category.
My "scary to use" category is defined as any function that works in some cases but, for no apparent reason, does not work in others.
After quite a bit of testing I've discovered that these commands will download almost any kind of file from some websites but don't seem to work at all on other websites. The real problem is that I don't know why they don't work on certain websites. If I did, then I could probably take them out of the "scary to use" category.
The test app I'm sending with my bug report is attached in case anyone else wants to try it. (The files to be downloaded by my test routines are on my website and will be there for at least a month. No guarantees after that. I purposely picked small files so they won't take long to download even on a phone modem.)
I also included my "scary to use" comments in the bug report so hopefully we can get some clarification on that as well.
Comment