On 15/12/15 09:14, Dominique Descamps wrote:

> As I'm dealing here with almost hundred batchfiles, some of them 
> containing several hundreds of lines of code, I'm more
> interested in a tool, who can do this conversion automatically.
>  
> Can you confirm me whether or not such a conversion tool already exists?

I certainly have never heard of such a thing.
Even if it did exist it would probably produce terrible Python code.

The reason I say that is that batch files (like Unix shell
scripts but more so) are essentially program launchers. They get the
work done by starting other programs. A Python conversion would
wind up being full of os.system() calls or Popen() calls.

Also the bat file control structures are very limited (much
worse than Unix shell) and a conversion script would be unable
to select more elegant structures. So while you might translate
the batch file code to Python it would probably be nearly as
unreadable and error prone as the original batch file was.

I would suggest your best bet is not to even try converting
all of the scripts but to tackle them one by one as you need
to work on them. This may mean that some of the scripts never
get converted, but those will be the ones that are stable and
working as intended. If they ain't broke, don't fix them...
The ones that need regular maintenance are the ones you most
want in Python.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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

Reply via email to