Hello,
I was wondering if someone could point me in the right direction. I would
like to develop some scripts to manage Cisco routers and switches using
XML. However, I am not sure where to start. Does someone have some
experience working with XML, Schemas and things like that? Which libraries
do y
On Mon, 05 Aug 2013 21:46:57 +0100, Rui Maciel wrote:
> Is there any pythonic way to perform static typing? After searching the
> web I've stumbled on a significant number of comments that appear to
> cover static typing as a proof of concept , but in the process I've
> found no tutorial on how t
Thanks I get it now.
--
http://mail.python.org/mailman/listinfo/python-list
On 6/08/2013 1:49 PM, alex23 wrote:
On 6/08/2013 1:12 PM, Joshua Landau wrote:
Because it's bad to open files without a with unless you know what
you're doing, use a with:
with open('/home/collier/pytest/__sort.TXT') as file:
sorted(file, key=str.casefold, reverse=True)
Shouldn'
On 6/08/2013 1:49 PM, alex23 wrote:
Shouldn't that be:
with open('/home/collier/pytest/__sort.TXT') as file:
data = file.readlines()
sorted(data, key=str.casefold, reverse=True)
I'm tempted to say "HINT #5: don't provide a solution without testing it
first" but that would
On 6/08/2013 1:12 PM, Joshua Landau wrote:
Because it's bad to open files without a with unless you know what
you're doing, use a with:
with open('/home/collier/pytest/__sort.TXT') as file:
sorted(file, key=str.casefold, reverse=True)
Shouldn't that be:
with open('/home/coll
On Monday, August 5, 2013 10:00:55 PM UTC-4, Devyn Collier Johnson wrote:
> I am wanting to sort a plain text file alphanumerically by the lines. I
>
> have tried this code, but I get an error. I assume this command does not
>
> accept newline characters.
>
>
>
>
>
> >>> file = open('/hom
On 6 August 2013 03:00, Devyn Collier Johnson wrote:
> I am wanting to sort a plain text file alphanumerically by the lines. I
> have tried this code, but I get an error. I assume this command does not
> accept newline characters.
>
HINT #1: Don't assume that without a reason. It's wrong.
> >>>
On 06/08/2013 03:00, Devyn Collier Johnson wrote:
I am wanting to sort a plain text file alphanumerically by the lines. I
have tried this code, but I get an error. I assume this command does not
accept newline characters.
>>> file = open('/home/collier/pytest/sort.TXT', 'r').read()
That ret
gratedme...@gmail.com wrote:
>
> I currently working on a game, where I need to maintain a running tally of
> money, as the player makes purchases as they navigate thru game. I not
> exactly sure how to do this in python. I know it is a fairly basic step,
> nonetheless. Any assistance would
On 6 August 2013 02:01, wrote:
>
> I currently working on a game, where I need to maintain a running tally of
> money, as the player makes purchases as they navigate thru game. I not
> exactly sure how to do this in python. I know it is a fairly basic step,
> nonetheless. Any assistance would
I am wanting to sort a plain text file alphanumerically by the lines. I
have tried this code, but I get an error. I assume this command does not
accept newline characters.
>>> file = open('/home/collier/pytest/sort.TXT', 'r').read()
>>> print(file)
z
c
w
r
h
s
d
>>> file.sort() #The first bl
I currently working on a game, where I need to maintain a running tally of
money, as the player makes purchases as they navigate thru game. I not
exactly sure how to do this in python. I know it is a fairly basic step,
nonetheless. Any assistance would be greatly appreciated.
--
http://m
Rui Maciel writes:
> Is there any pythonic way to perform static typing?
I think no; static typing is inherently un-Pythonic.
Python provides strong, dynamic typing. Enjoy it!
> Does anyone care to enlighten a newbie?
Is there some specific problem you think needs static typing? Perhaps
you c
On Mon, Aug 5, 2013 at 2:46 PM, Rui Maciel wrote:
> Is there any pythonic way to perform static typing? After searching the web
> I've stumbled on a significant number of comments that appear to cover
> static typing as a proof of concept , but in the process I've found no
> tutorial on how to im
i was able to get what i wanted by simply iterating over the tupile instead of
using ParseTupile, then just query the type, then convert the type to C and
move on to the next. totally great, now i can pass N different argument types
to a single function, and have the C side deal gracefully with
On 05/08/2013 22:47, Luca Cerone wrote:
You're back to using separate threads for the reader and the writer.
And how do I create separate threads in Python? I was trying to use the
threading library without not too success..
To run a function in a separate thread:
import threading
def my_f
Le 05/08/2013 22:01, Rafael Durán Castañeda a écrit :
> I think you are looking for exclusive groups:
>
> http://docs.python.org/2.7/library/argparse.html#argparse.add_mutually_exclusive_group
Yes... but no. The doc explains you can do this:
my-script (-b VALUE-B | -d VALUE-D)
ie mutally excl
On Mon, Aug 5, 2013 at 11:24 PM, wrote:
> I have this script to monitor solr4 with munin.
>
> But I get an error and I hove no idea what's the problem.
>
> Error:
> /etc/munin/plugins/solr4_multicore_avgRequestsPerSecond:60: undefined method
> []' for nil:NilClass (NoMethodError)
>
> cores_url =
Hi,
I have this script to monitor solr4 with munin.
But I get an error and I hove no idea what's the problem.
Hope someone can help me...
Thanks,
Torsten
Error:
/etc/munin/plugins/solr4_multicore_avgRequestsPerSecond:60: undefined method
[]' for nil:NilClass (NoMethodError)
from /etc/munin/
> I think you are looking for exclusive groups:
>
> http://docs.python.org/2.7/library/argparse.html#argparse.add_mutually_excl
> usive_group
No. That links first doc line in that method shows the very point we are all
discussing:
"Create a mutually exclusive group. argparse will make sure that
Le 05/08/2013 16:11, Miki Tebeka a écrit :
> You can probably do something similar using sub commands
> (http://docs.python.org/2/library/argparse.html#sub-commands).
Yes, but this is not the same syntax. I want this syntax :
my-script (-a -b VALUE-B | -c -d VALUE-D)
I don't want this syntax:
> You're back to using separate threads for the reader and the writer.
>
And how do I create separate threads in Python? I was trying to use the
threading library without not too success..
--
http://mail.python.org/mailman/listinfo/python-list
On 08/05/2013 01:46 PM, Rui Maciel wrote:
Is there any pythonic way to perform static typing? After searching the web
I've stumbled on a significant number of comments that appear to cover
static typing as a proof of concept , but in the process I've found no
tutorial on how to implement it.
Do
Is there any pythonic way to perform static typing? After searching the web
I've stumbled on a significant number of comments that appear to cover
static typing as a proof of concept , but in the process I've found no
tutorial on how to implement it.
Does anyone care to enlighten a newbie?
T
El 04/08/13 04:10, Francois Lafont escribió:
Hi,
Is it possible with argparse to have this syntax for a script?
my-script (-a -b VALUE-B | -c -d VALUE-D)
I would like to do this with the argparse module.
Thanks in advance.
I think you are looking for exclusive groups:
http://docs.python.o
On 05/08/2013 17:54, Luca Cerone wrote:
Thanks this works (if you add shell=True in Popen).
If I don't want to use shell = True, how can I redirect the stdout to
named_pipe? Popen accepts an open file handle for stdout, which I can't open
for writing because that blocks the process...
You're
I have found telnetlib which make very easy to interact with a telnet server,
especially the read_until command. I wonder if something similar exits for
other things that a telnet server. I for the moment have in mind interacting
with a GSM modem (we do it by reading and writing a pseudo serial
On 05/27/2013 04:33 AM, Luca Cerone wrote:
Will it violate privacy / NDA to post the command line? Even if we
can't actually replicate your system, we may be able to see something
from the commands given.
Unfortunately yes..
p1 = Popen(['nsa_snoop', 'terror_suspect', '--no-privacy', '-
> You can probably do something similar using sub commands
> (http://docs.python.org/2/library/argparse.html#sub-commands).
The problem here is that argparse does not pass the subparser into the
parsed args and shared args between subparsers need to be declared
each time. Come execution time, when
Thanks this works (if you add shell=True in Popen).
If I don't want to use shell = True, how can I redirect the stdout to
named_pipe? Popen accepts an open file handle for stdout, which I can't open
for writing because that blocks the process...
>
>
> os.mkfifo("named_pipe", 0777)
>
> ls_proc
On 2013-08-05, Luca Cerone wrote:
> I just would like to learn how to handle named pipes in Python,
> which I find it easier to do by using a simple example that I
> am comfortable to use :)
Names pipes are a unix concept that saves you the hassle and
limitations of writing to and reading from a
On 05/08/2013 16:27, Luca Cerone wrote:
Thanks MRAB,
You need to ensure that the pipe is already open at the other end.
So I need to open the process that reads the pipe before writing in
it?
Why are you using a named pipe anyway?
For some bug in ipython (see my previous email) I can't u
thanks and what about python 2.7?
>
>
> In Python 3.3 and above:
>
>
>
> p = subprocess.Popen(..., stderr=subprocess.DEVNULL)
P.s. sorry for the late reply, I discovered I don't receive notifications from
google groups..
--
http://mail.python.org/mailman/listinfo/python-list
Thanks MRAB,
>
> You need to ensure that the pipe is already open at the other end.
So I need to open the process that reads the pipe before writing in it?
>
>
>
> Why are you using a named pipe anyway?
For some bug in ipython (see my previous email) I can't use subprocess.Popen
and pipe in
On Mon, Aug 5, 2013 at 8:58 AM, Markus Rother wrote:
> Thanks for the good explanation.
>
> My intention was to pass a custom method/function as a comparator
> to an object. My misconception was, that __eq__ is equivalent to
> the '==' operator, and could be passed as a first class function.
> Ap
Hi Alister,
> Are you sure you are using the correct tool for the task?
Yes. For two reasons: 1. I want to learn how to do this in Python :) 2. for an
application I have in mind I will need to run external tools (not developed by
me) and process the output using some tools that I have written in
Thanks for the good explanation.
My intention was to pass a custom method/function as a comparator
to an object. My misconception was, that __eq__ is equivalent to
the '==' operator, and could be passed as a first class function.
Apparently, that is not possible without wrapping the comparison
i
On 05/08/2013 15:11, Luca Cerone wrote:
Hi MRAB, thanks for the reply!
Opening the pipe for reading will block until it's also opened for
writing, and vice versa.
OK.
In your bash code, 'ls' blocked until you ran 'cat', but because you
ran 'ls' in the background you didn't notice it!
R
On Mon, 05 Aug 2013 06:09:53 -0700, Luca Cerone wrote:
> Hi everybody,
> I am trying to understand how to use named pipes in python to launch
> external processes (in a Linux environment).
>
> As an example I am trying to "imitate" the behaviour of the following
> sets of commands is bash:
>
>>
> Is it possible with argparse to have this syntax for a script?
> my-script (-a -b VALUE-B | -c -d VALUE-D)
>
> I would like to do this with the argparse module.
You can probably do something similar using sub commands
(http://docs.python.org/2/library/argparse.html#sub-commands).
--
http://mai
Hi MRAB, thanks for the reply!
>
> Opening the pipe for reading will block until it's also opened for
>
> writing, and vice versa.
>
OK.
>
>
> In your bash code, 'ls' blocked until you ran 'cat', but because you
>
> ran 'ls' in the background you didn't notice it!
>
>
Right.
>
> In your
On 05/08/2013 14:09, Luca Cerone wrote:
Hi everybody,
I am trying to understand how to use named pipes in python to launch external
processes (in a Linux environment).
As an example I am trying to "imitate" the behaviour of the following sets of
commands is bash:
mkfifo named_pipe
ls -lah >
Hi Paul, first of all thanks for the help.
I am aware of the first solutions, just now I would like to experiment a bit
with using named pipes (I also know that the example is trivial, but it just
to grasp the main concepts)
>
> You can also pass a file object to p1's stdout and p2's stdin if
On 5 August 2013 14:09, Luca Cerone wrote:
> Hi everybody,
> I am trying to understand how to use named pipes in python to launch
> external processes (in a Linux environment).
>
> As an example I am trying to "imitate" the behaviour of the following sets
> of commands is bash:
>
> > mkfifo named
On Tue, Jul 23, 2013 at 2:49 PM, Chris Angelico wrote:
> Ah, there's a solution to this one. You simply use your own
> envelope-from address; SPF shouldn't be being checked for the From:
> header. Forwarding and using the original sender's address in the SMTP
> 'MAIL FROM' command is forging mai
Hi everybody,
I am trying to understand how to use named pipes in python to launch external
processes (in a Linux environment).
As an example I am trying to "imitate" the behaviour of the following sets of
commands is bash:
> mkfifo named_pipe
> ls -lah > named_pipe &
> cat < named_pipe
In Pyt
On Mon, Aug 5, 2013 at 1:34 AM, Helmut Jarausch
wrote:
> Hi,
>
> I'd like to subclass array.array and implement operators like __iadd__
> How can this be accomplished.
>
> I'tried
>
> from array import array
>
> class Vec(array) :
> def __new__(cls,Vinit) :
> return array.__new__(cls,'d',Vin
Hi,
I'd like to subclass array.array and implement operators like __iadd__
How can this be accomplished.
I'tried
from array import array
class Vec(array) :
def __new__(cls,Vinit) :
return array.__new__(cls,'d',Vinit)
def __init__(self,*args) :
self.N = len(self)
def __str__(self
On 2013-08-04, Chris Angelico wrote:
> On Sun, Aug 4, 2013 at 8:21 PM, JohnD wrote:
>> On 2013-08-04, Chris Angelico wrote:
[...]
>
> Python does have a slightly odd (compared to other languages)
> interpretation of "variable assignments" (name bindings, really)
> inside a class block. Trips up
Am 02.08.2013 15:17, schrieb matt.doolittl...@gmail.com:
so you are saying that
self.logfile.write('%s\t'%(str(time(
should be:
self.logfile.write('%s\t'%(str(time.time(
No, I'm not saying that. What I wanted to make clear is that your code
is impossible to understand as it
51 matches
Mail list logo