[Tutor] Newbie question. Is it possible to run/call a python2.7 program and reference results from/in python3.3?

Alan Gauld alan.gauld at btinternet.com
Fri Sep 13 18:46:33 CEST 2013


On 13/09/13 15:59, Paul Smith wrote:

> So there are many tools out there but mechanize and scrapy 3rd party
> modules seem to produce the best results; however nothing like these
> exist for Python3. I get close but cannot produce the clean simple url
> results in python3

Yes that's the biggest barrier to python 3 adoption. There are
just too many tools that have not been ported yet.


> But now go do the same in python3? I am stumped...

You can do it but it's a rewrite with other modules.

> So can one call the python27 program and use results in python33?

Yes via the subprocess module. You can execute any program that 
reads/writes to stdin/out and access the output. Its not exactly
pretty but it works.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list