Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34884

Re: os.system and subprocess odd behavior

From Dieter Maurer <dieter@handshake.de>
Subject Re: os.system and subprocess odd behavior
Date 2012-12-15 08:12 +0100
References <bb08fc10-85f0-4003-a1fb-cdc449299d19@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.901.1355555550.29569.python-list@python.org> (permalink)

Show all headers | View raw


py_genetic <conor.robinson@gmail.com> writes:

> Example of the issue for arguments sake:
>
> Platform Ubuntu server 12.04LTS, python 2.7
>
> Say file1.txt has "hello world" in it.
      ^^^^^^^^^
Here, you speak of "file1.txt" (note the extension ".txt")

> subprocess.Popen("cat < file1 > file2", shell = True)
> subprocess.call("cat < file1 > file2", shell = True)
> os.system("cat < file1 > file2")

But in your code, you use "file1" (without extension).

If your code really references a non-existing file, you may well
get what you are observing.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-14 10:13 -0800
  Re: os.system and subprocess odd behavior Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-14 22:47 +0000
    Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-17 08:39 -0800
      Re: os.system and subprocess odd behavior Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-12-17 17:16 +0000
        Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-17 12:56 -0800
          Re: os.system and subprocess odd behavior Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-12-18 00:01 +0000
            Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-18 10:26 -0800
              Re: os.system and subprocess odd behavior Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-12-18 18:52 +0000
                Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-18 12:52 -0800
                Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-18 12:52 -0800
            Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-18 10:26 -0800
          Re: os.system and subprocess odd behavior Hans Mulder <hansmu@xs4all.nl> - 2012-12-18 23:46 +0100
        Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-17 12:56 -0800
  Re: os.system and subprocess odd behavior Dieter Maurer <dieter@handshake.de> - 2012-12-15 08:12 +0100
    Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-17 08:30 -0800
    Re: os.system and subprocess odd behavior py_genetic <conor.robinson@gmail.com> - 2012-12-17 08:30 -0800
  Re: os.system and subprocess odd behavior photonymous@gmail.com - 2012-12-17 21:10 -0800
    Re: os.system and subprocess odd behavior Hans Mulder <hansmu@xs4all.nl> - 2012-12-18 11:27 +0100
      Re: os.system and subprocess odd behavior Dave Angel <d@davea.name> - 2012-12-18 05:39 -0500
        Re: os.system and subprocess odd behavior Hans Mulder <hansmu@xs4all.nl> - 2012-12-18 12:40 +0100

csiph-web