newbie question about subprocess.Popen() arguments

2013-05-23 Thread Alex Naumov
Hello,

I'm trying to call new process with some parameters. The problem is that
the last parameter is a "string" that has a lot of spaces and different
symbols like slash and so on. I can save it in file and use name of this
file as parameter, but my question is: how to make it without   additional
saving?

import subprocess as sp

rc = sp.Popen(["prog", "--options", "<", msg], stdin=sp.PIPE,
stdout=sp.PIPE)
stdout = rc.communicate()[0]
print stdout



Thank you,
Alex

p.s.
type(msg) => 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question about subprocess.Popen() arguments

2013-05-23 Thread Alex Naumov
Thank you very much, Peter!
It works!


On Thu, May 23, 2013 at 9:32 AM, Peter Otten <__pete...@web.de> wrote:

> Alex Naumov wrote:
>
> > I'm trying to call new process with some parameters. The problem is that
> > the last parameter is a "string" that has a lot of spaces and different
> > symbols like slash and so on. I can save it in file and use name of this
> > file as parameter, but my question is: how to make it without
> additional
> > saving?
> >
> > import subprocess as sp
> >
> > rc = sp.Popen(["prog", "--options", "<", msg], stdin=sp.PIPE,
> > stdout=sp.PIPE)
> > stdout = rc.communicate()[0]
> > print stdout
>
> > p.s.
> > type(msg) => 
>
> The < operator is a shell feature, not an argument, and msg is intended to
> be send to prog's stdin. The communicate() method accepts a parameter for
> that. So:
>
> rc = sp.Popen(["prog", "--options"], stdin=sp.PIPE, stdout=sp.PIPE)
> stdout = rc.communicate(msg)[0]
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Your favorite test tool and automation frameworks

2012-08-27 Thread Alex Naumov
Hello everybody,

I would like to ask about your favorite python test frameworks. I never
used it before (beginner in testing) and would like to start to learn Unit-
and GUI-testing.

I look now at PyUnit/unittest and dogtail. Maybe someone
can recommend something better or just share experiences?


Thank you,
Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


HTTPSConnection from http.client?

2015-11-17 Thread Alex Naumov
Hello,

does anybody know how to create a HTTPS connections in python2 or python3?
I tried second day to do that with http.client[1], but every time get error:

from http.client import HTTPSConnection
ImportError: cannot import name HTTPSConnection


Where is HTTPSConnection located? Which module?

I use openSUSE 13.1 x86_64.

Thank you,
Alex


[1] https://docs.python.org/3/library/http.client.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: HTTPSConnection from http.client?

2015-11-17 Thread Alex Naumov
On Tue, Nov 17, 2015 at 12:22 PM, Peter Otten <__pete...@web.de> wrote:
> Alex Naumov wrote:
>
>> Hello,
>>
>> does anybody know how to create a HTTPS connections in python2 or python3?
>> I tried second day to do that with http.client[1], but every time get
>> error:
>>
>> from http.client import HTTPSConnection
>> ImportError: cannot import name HTTPSConnection
>>
>>
>> Where is HTTPSConnection located? Which module?
>>
>> I use openSUSE 13.1 x86_64.
>>
>> Thank you,
>> Alex
>>
>>
>> [1] https://docs.python.org/3/library/http.client.html
>
> Did you compile Python from source?

No, I install it as a package.

> You may be missing the development
> packages.

Yes, it looks like some packages are not there.


> On a minimal SLES-12-x86_64 installation:

Can you tell me what's the name of package with http.client module please?

Thank you,
Alex
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: HTTPSConnection from http.client?

2015-11-17 Thread Alex Naumov
Hello Peter,

thanks for your reply.

>>> import ssl

Works well in python2 and 3.

Maybe somebody know another way to create a SSL connection (username/password)?
I just need to log in and log out.

Thanks,
Alex

On Tue, Nov 17, 2015 at 2:24 PM, Peter Otten <__pete...@web.de> wrote:
> Alex Naumov wrote:
>
>> On Tue, Nov 17, 2015 at 12:22 PM, Peter Otten <__pete...@web.de> wrote:
>>> Alex Naumov wrote:
>>>
>>>> Hello,
>>>>
>>>> does anybody know how to create a HTTPS connections in python2 or
>>>> python3? I tried second day to do that with http.client[1], but every
>>>> time get error:
>>>>
>>>> from http.client import HTTPSConnection
>>>> ImportError: cannot import name HTTPSConnection
>>>>
>>>>
>>>> Where is HTTPSConnection located? Which module?
>>>>
>>>> I use openSUSE 13.1 x86_64.
>>>>
>>>> Thank you,
>>>> Alex
>>>>
>>>>
>>>> [1] https://docs.python.org/3/library/http.client.html
>>>
>>> Did you compile Python from source?
>>
>> No, I install it as a package.
>>
>>> You may be missing the development
>>> packages.
>>
>> Yes, it looks like some packages are not there.
>>
>>
>>> On a minimal SLES-12-x86_64 installation:
>>
>> Can you tell me what's the name of package with http.client module please?
>
> You already have that module as it is part of the Python standard
> installation. You can double check by importing something that is always
> available. E. g. the following should succeed on your system
>
>>>> from http.client import HTTPConnection
>>>>
>
> What you are likely missing is ssl support. Try
>
>>>> import ssl
>
> to verify that it fails and post the traceback.
>
> Unfortunately my conclusion from Marco's post is that
>
>>>> from http.client import HTTPSConnection
>
> should succeed on your system without the need for additional packages.
> Something seems to be broken, but I have no idea what, sorry.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


send string to input of another process

2011-09-13 Thread Alex Naumov
Hello everybody,

I'm looking for some solution, maybe someone of you can help me.

I call another process via os.system("process") and it waits for some input.
I have to write a comment (for example, like using svn or git), and after
that to close input (for example, like ":wq" using vim).
How can I give/write this comment and put it in the input for next process
(which start after)?


Thanks a lot for your time and help.
-- 
http://mail.python.org/mailman/listinfo/python-list