Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4798
| From | Reimar Bauer <rb.proj@gmail.com> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] os.system und os.popen |
| Date | 2017-05-25 23:30 +0200 |
| Message-ID | <mailman.9.1495747827.13056.python-de@python.org> (permalink) |
| References | (1 earlier) <mailman.46.1495726174.8815.python-de@python.org> <eooc7gFaul8U1@mid.individual.net> <5d4200a7-d838-9135-8aba-17bc4fe8a036@mail.de> <5d880bc4-41ef-5566-2f8e-17a7a447b23e@sschwarzer.net> <CADfaKO8Nw3eOByo5HpQeh17R8RNMLDoYJfUpZWiEzyrrsiRjBw@mail.gmail.com> |
Ich hab letztens noch EasyProcess kennen gelernt.
https://pypi.python.org/pypi/EasyProcess
Viele Grüße
Reimar
2017-05-25 20:01 GMT+02:00 Stefan Schwarzer <sschwarzer@sschwarzer.net>:
> On 2017-05-25 19:06, Sven R. Kunze wrote:> On 25.05.2017 17:40, Hermann
> Riemann wrote:
> >> error=os.system("latex ... 2> /tmp/log")
> >>
> >> Hermann
> >> der das so machen würde
> >>
> >
> > Sieht durchaus einfacher aus, ist aber nicht ganz unsicher, wenn's um
> > das Thema Quoting von Parametern geht.
> >
> > *Hier auch noch zum Nachlesen:*
> > https://docs.python.org/3.6/library/subprocess.html
>
> `subprocess` ist nicht nur sicherer, sondern auch ganz
> allgemein robuster.
>
> Es wird zwar immer hervorgehoben, dass mit dem Modul keine
> Angriffe mit speziellen Dateinamen möglich sind (was stimmt),
> aber das Modul hilft auch, wenn zum Beispiel Dateinamen ganz
> ohne böse Absicht Leerzeichen enthalten oder Zeichen, die
> sonst von der Shell interpretiert werden würden.
>
> Beispiel:
>
> dateiname = "dies & das.txt" # von irgendwoher
>
> ausgabe = subprocess.check_output(["du", "--human-readable",
> "--summarize", dateiname])
>
> Viele Grüße
> Stefan
> _______________________________________________
> python-de maillist - python-de@python.org
> https://mail.python.org/mailman/listinfo/python-de
>
Back to de.comp.lang.python | Previous | Next — Previous in thread | Find similar
[Python-de] os.system und os.popen Ulrich Goebel <ml@fam-goebel.de> - 2017-05-25 17:19 +0200
Re: [Python-de] os.system und os.popen Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-05-25 17:40 +0200
Re: [Python-de] os.system und os.popen "Sven R. Kunze" <srkunze@mail.de> - 2017-05-25 19:06 +0200
Re: [Python-de] os.system und os.popen Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2017-05-25 20:01 +0200
Re: [Python-de] os.system und os.popen Reimar Bauer <rb.proj@gmail.com> - 2017-05-25 23:30 +0200
csiph-web