On 05/01/2017 06:12 PM, Ian Monat wrote:
> Thank you for the reply Mats.
> 
> I agree the fact that files are wrapped in an .exe is ridiculous. We're
> talking about a $15B company that is doing this by the way, not a ma and pa
> shop.  Anyways...
> 
> If I understand you correctly, you're saying I can:
> 
> 1) Use Python to download the file from the web (but not by using a
> webscraper, according to Alan)
> 2) Simply ignore the .exe wrapper and use, maybe Windows Task Manager, to
> unzip the file and place the .txt file in the desired folder
> 
> Am I understanding you correctly?
> 
> Thank you -Ian

Once you figure out the filename to download - and this may require some
scraping of the page - I'm thinking something like:

import subprocess

downloaded_filename = "something.exe"  # whatever you found to download
cmd = "7z x " + downloaded_filename
res = subprocess.check_output(cmd)

examine res to make sure there was something to extract
then go on and fish file(s) out of the zipfile

I have nothing to experiment with this on, so it's just "thinking out loud".

I have at some point used 7z (and most of the other windows archivers
that you'd consider "third party" can probably do something like)
interactively to fish a zip out of an exe, but there's no reason it
wouldn't work from the command line that I know of.

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to