Hey,
I'm trying to run a sudo guarded command over SSH using paramiko
+++
s = paramiko.SSHClient()
s.load_system_host_keys()
s.connect(hostname, port, username, passwd)
stdin, stdout, stderr = s.exec_command('sudo -s')
stdin.write('password\n')
stdin.flush()
print 'Flushing'
stdin,
Hey,
I'm trying to execute a command over a remore server using pexpect
+
url = 'ssh internalserver'
res = pexpect.spawn(url)
print '1'
res.expect('.*ssword:')
print '2'
res.sendline('mypasswd')
print '3'
res.sendline('ls -aslh')
+
What I want to do is to send a coup
Hey,
I want to perform commands on a remote server over SSH.
What do I need?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 3, 1:54 pm, John Machin wrote:
> On Mar 3, 10:22 pm, Hussein B wrote:
>
> > > > Hey,
> > > > I added use_unicode and charset keyword params to the connect() method
>
> > > Hey, that was a brilliant idea -- I was just about to ask you to try
> &
On Mar 3, 12:21 pm, John Machin wrote:
> On Mar 3, 8:49 pm, Hussein B wrote:
>
>
>
> > On Mar 3, 11:05 am, Hussein B wrote:
>
> > > On Mar 2, 5:40 pm, John Machin wrote:
>
> > > > On Mar 3, 1:50 am, Hussein B wrote:
>
> > > > > On
On Mar 3, 11:05 am, Hussein B wrote:
> On Mar 2, 5:40 pm, John Machin wrote:
>
>
>
> > On Mar 3, 1:50 am, Hussein B wrote:
>
> > > On Mar 2, 4:31 pm, John Machin wrote:> On Mar 2,
> > > 7:30 pm, Hussein B wrote:
>
> > > > > On Mar
On Mar 2, 5:40 pm, John Machin wrote:
> On Mar 3, 1:50 am, Hussein B wrote:
>
>
>
> > On Mar 2, 4:31 pm, John Machin wrote:> On Mar 2,
> > 7:30 pm, Hussein B wrote:
>
> > > > On Mar 1, 4:51 pm, Philip Semanchuk wrote:
>
> > > > > On
On Mar 2, 4:31 pm, John Machin wrote:
> On Mar 2, 7:30 pm, Hussein B wrote:
>
> > On Mar 1, 4:51 pm, Philip Semanchuk wrote:
>
> > > On Mar 1, 2009, at 8:31 AM, Hussein B wrote:
>
> > > > Hey,
> > > > I'm retrieving records from MyS
On Mar 2, 4:03 pm, "J. Clifford Dyer" wrote:
> On Mon, 2009-03-02 at 00:33 -0800, Hussein B wrote:
> > On Mar 1, 11:27 pm, "J. Clifford Dyer" wrote:
> > > On Sun, 2009-03-01 at 09:51 -0500, Philip Semanchuk wrote:
> > > > On Mar 1,
On Mar 1, 11:27 pm, "J. Clifford Dyer" wrote:
> On Sun, 2009-03-01 at 09:51 -0500, Philip Semanchuk wrote:
> > On Mar 1, 2009, at 8:31 AM, Hussein B wrote:
>
> > > Hey,
> > > I'm retrieving records from MySQL database that contains non english
> &
On Mar 1, 4:51 pm, Philip Semanchuk wrote:
> On Mar 1, 2009, at 8:31 AM, Hussein B wrote:
>
> > Hey,
> > I'm retrieving records from MySQL database that contains non english
> > characters.
> > Then I create a String that contains HTML markup and column valu
Hey,
I'm retrieving records from MySQL database that contains non english
characters.
Then I create a String that contains HTML markup and column values
from the previous result set.
+
markup = u'''.'''
for row in rows:
markup = markup + '' + row['id']
markup = markup + '
+
Then I'
Hey,
I have a log file that doesn't contain the word "Haskell" at all, I'm
just trying to do a little performance comparison:
++
from datetime import time, timedelta, datetime
start = datetime.now()
print start
lines = [line for line in file('/media/sda4/Servers/Apache/
Tomcat-6.0.14/lo
On Jan 20, 5:04 pm, Carsten Haese wrote:
> Hussein B wrote:
> > Hey,
> > I'm creating a report that is supposed to harvest the data for the
> > previous month.
> > So I need a way to get the first day and the last day of the previous
> > month.
>
>
Hey,
I'm creating a report that is supposed to harvest the data for the
previous month.
So I need a way to get the first day and the last day of the previous
month.
Would you please tell me how to do this?
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
I'm trying to get the get the date before today, I tried this:
d = datetime.now() - timedelta(days = -1)
But I got the date of tomorrow.
when I tried:
d = datetime.now() + timedelta(days = -1)
I got the date of yesterday.
Would you please explain to me why I got the date of yesterday when I
ad
Hey,
I know the basics of interacting with databases in Python.
How to start a transaction in case I want to group a couple of insert
and update statements into a single operation?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
I'm new with database interactions in Python and I'm not sure if I'm
handling the cursor and transactions correctly:
cursor = db.cursor(MySQLdb.cursors.DictCursor)
cursor.execute(flate_rate_pkgs_sql)
rows = cursor.fetchall()
#I have for loop here to iterate over rows
cursor.execute
On Jan 14, 2:21 pm, Steven D'Aprano wrote:
> On Wed, 14 Jan 2009 01:57:48 -0800, Hussein B wrote:
> >> Well... Because it is correct ?
>
> >> What make you think it _shouldn't_ work ?
>
> > Because def2 is defined after def1 in an interpreted languag
On Jan 14, 11:55 am, Bruno Desthuilliers wrote:
> Hussein B a écrit :
>
> > Hey,
> > Why this code is working?
>
> >>>> def f1( ):
> > ... x = 88
> > ... f2(x)
> > ...
> >>>> def f2(x):
> > ... print x
&g
Hey,
Why this code is working?
>>> def f1( ):
... x = 88
... f2(x)
...
>>> def f2(x):
... print x
...
>>> f1( )
88
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
What is the best code coverage tool available for Python?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 28, 2:04 pm, "Chris Rebert" wrote:
> On Sun, Dec 28, 2008 at 3:40 AM, Hussein B wrote:
> > Hey,
> > What is /usr/lib/pythonx.y/site-packages folder and for what it is
> > used usually?
>
> I believe it's where third-party libraries are t
Hey,
What is /usr/lib/pythonx.y/site-packages folder and for what it is
used usually?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Which PostgreSQL adapter to use:
PyGreSQL, PyPgSQL or psycopg?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
Which Adapter to use with PostgreSQL:
PyPgSQL, psycopg or PyGreSQL?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
This is an example of a generator function:
=
def counter(start_at=0):
count = start_at
while True:
val = (yield count)
if val is not None:
count = val
else:
count += 1
==
>>> count = counter(5)
>>> count.next()
5
>>> count.send(9
On Aug 25, 4:31 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sun, 24 Aug 2008 23:56:27 -0700, Hussein B wrote:
> > On Aug 24, 7:12 pm, Steven D'Aprano <[EMAIL PROTECTED]
> > cybersource.com.au> wrote:
> >> >> I noted that Python
On Aug 24, 7:12 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sun, 24 Aug 2008 12:28:53 +0200, Peter Otten wrote:
> > Hussein B wrote:
>
> >> I noted that Python encourage the usage of: --
> >> obj.prop = data
> >> x = obj
On Aug 24, 5:28 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> Hussein B wrote:
> > I noted that Python encourage the usage of:
> > --
> > obj.prop = data
> > x = obj.prop
> > --
> > to set/get an object's property value.
> > What if I want to
Hey,
I noted that Python encourage the usage of:
--
obj.prop = data
x = obj.prop
--
to set/get an object's property value.
What if I want to run some logic upon setting/getting a property?
What is Python preferred method to do so (using the new feature
'property')?
I don't think __getattr__ and __s
Hi,
I'm familiar with static method concept, but what is the class method?
how it does differ from static method? when to use it?
--
class M:
def method(cls, x):
pass
method = classmethod(method)
--
Thank you for your time.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
Please correct me if I'm wrong but Python doesn't support method
overload, right?
--
def method(self):
#code
def method(self, data):
#code
--
The last declaration of method() erase the previous one (like
JavaScript).
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
Well, as you all know by now, I'm learning Python :)
One thing that is annoying my is the OOP in Python.
Consider this code in Java:
--
public class Car {
private int speed;
private String brand;
// setters & getters
}
--
With one look at the top of the class, you can know that each
ins
On Aug 20, 6:39 am, Bruno Desthuilliers wrote:
> Hussein B a écrit :
> (snip)
>
> > One more question:
> > If I have this structure:
> > orig/com/domain/project/Klass1.py
> > Klass2.py
> > __init__.py
>
On Aug 20, 5:43 am, John Machin <[EMAIL PROTECTED]> wrote:
> On Aug 20, 8:08 pm, Hussein B <[EMAIL PROTECTED]> wrote:
>
> > Hey,
> > Suppose I have a Python application consists of many modules (lets say
> > it is a Django application).
> > If all the m
On Aug 20, 5:43 am, John Machin <[EMAIL PROTECTED]> wrote:
> On Aug 20, 8:08 pm, Hussein B <[EMAIL PROTECTED]> wrote:
>
> > Hey,
> > Suppose I have a Python application consists of many modules (lets say
> > it is a Django application).
> > If all the m
Hey,
Suppose I have a Python application consists of many modules (lets say
it is a Django application).
If all the modules files are importing sys module, how many times the
sys module will be compiled and executed?
Only once (the first time the PVM locates, compiles and executes the
sys module)?
On Aug 19, 8:10 am, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Aug 19, 8:16 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hussein B wrote:
> > > Is the standard library of Python is compiled (you know, the pyc
> > > thing)?
> > &
Hey,
Are Python eggs and RubyGems do the same thing (of course Gems is for
Ruby and eggs is for Python)?
If yes, is it outstanding as the RubyGems?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 19, 7:16 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Hussein B wrote:
> > Is the standard library of Python is compiled (you know, the pyc
> > thing)?
> > Is it allowed to edit the source code of the standard library?
> > I'm not talking about
Hey,
Is the standard library of Python is compiled (you know, the pyc
thing)?
Is it allowed to edit the source code of the standard library?
I'm not talking about submitting the modified code to Python source
code repository, I'm just asking if some one can edit the source code
in his own machine.
Hey,
AOP is build in Groovy language via many means, does Python support
AOP out of the box without the need for such tools:
http://pythonsource.com/open-source/aspect-oriented-frameworks
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 15, 10:05 am, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Hussein B a écrit :
> (snip)
>
> > But this critisim looks so serious:
> >http://en.wikipedia.org/wiki/Ruby_programming_language#Criticism
>
> Most of what's written here could apply to Py
On Aug 13, 11:14 am, Alia Khouri <[EMAIL PROTECTED]> wrote:
> Hussein B wrote:
> > I'm a Java/Java EE developer and I'm playing with Python these days.
> > I like the Python language so much and I like its communities and the
> > Django framework.
>
>
On Aug 13, 8:08 am, Bruno Desthuilliers wrote:
> Hussein B a écrit :
> (snip)
>
>
>
> > Personally, I don't like the RoR framework at all.
> > It doesn't come with any thing new or revolutionary,
>
> You could say the same about Python and about Djang
On Aug 13, 7:50 am, Bruno Desthuilliers wrote:
> Hussein B a écrit :
>
> > Hey,
> > I'm a Java/Java EE developer and I'm playing with Python these days.
> > I like the Python language so much and I like its communities and the
> > Django framework.
>
On Aug 13, 7:40 am, Bruno Desthuilliers wrote:
> Álvaro G. Vicario a écrit :
>
>
>
> > Hussein B escribió:
> >> The sad fact (at least to me), Ruby is getting a lot of attention
> >> these days.
> >> Why Python isn't getting this attention alth
On Aug 13, 6:51 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]
nomine.org> wrote:
> -On [20080813 13:16], Hussein B ([EMAIL PROTECTED]) wrote:
>
> >My friends are about to open a Ruby/Rails shop and they are asking me
> >to join them.
>
> I hope they are fully
Hey,
I'm a Java/Java EE developer and I'm playing with Python these days.
I like the Python language so much and I like its communities and the
Django framework.
My friends are about to open a Ruby/Rails shop and they are asking me
to join them.
I don't know what, sure I'm not leaving Java, but the
Hi.
Apache Ant is the de facto building tool for Java (whether JSE, JEE
and JME) application.
With Ant you can do what ever you want: compile, generate docs,
generate code, packing, deploy, connecting to remote servers and every
thing.
Do we have such a tool for Python projects?
Thank you.
--
http:
Hi.
Please correct my if I'm wrong but it seems to me that the major
continuous integration servers (Hudson, CruiseControl, TeamCity ..)
don't support Python based application.
It seems they mainly support Java, .NET and Ruby.
Can I use one of the previous listed servers for Python project?
Thanks.
On Jul 28, 8:11 am, Duncan Booth <[EMAIL PROTECTED]> wrote:
> Hussein B <[EMAIL PROTECTED]> wrote:
> > If I have a couple of modules, is there a way to package them? or
> > there is no such a thing in Python?
>
> It sounds rather as though you haven't yet g
On Jul 28, 6:55 am, Floris Bruynooghe <[EMAIL PROTECTED]>
wrote:
> On Jul 28, 9:54 am, Hussein B <[EMAIL PROTECTED]> wrote:
>
> > Hi.
> > I'm a Java guy and I'm playing around Python these days...
> > In Java, we organize our classes into packages an
Hi.
I'm a Java guy and I'm playing around Python these days...
In Java, we organize our classes into packages and then jarring the
packages into JAR files.
What are modules in Python?
What is the equivalent of modules in Java?
Please correct me if I'm wrong:
I saved my Python code under the file
55 matches
Mail list logo