Rudra Banerjee wrote:
>
>Friends,
>I am in process learning python.
>I basically use shell scripts for text formatting and trying my hand on
>python.
>where I am fighting is awk's functionality in python.
>Say, one of my real tiny code looks like:
>#!/bin/bash
>TMP=store
>for i in $1/MnBi_EOS_*
>
On Fri, 09 Nov 2012 12:34:27 +0100, Hans Mulder wrote:
> On 7/11/12 01:13:47, Steven D'Aprano wrote:
>> Hit the J key, and the event includes character "j". Hit Shift-J, and
>> character "J" is sent. Hit Ctrl-J, and the character sent is the ASCII
>> control character ^J, or newline. (Technically
On Fri, 09 Nov 2012 20:51:47 -0800, moonhkt wrote:
> HI All
>
> How to skip Trackback warning/error when input ftp address is not
> correct or reject ?
The same way you would skip any other error when you do something wrong:
catch the exception.
--
Steven
--
http://mail.python.org/mailman/l
HI All
How to skip Trackback warning/error when input ftp address is not
correct or reject ?
AIX 5.3
from ftplib import FTP
import ftplib
import sys
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-a","--remote_host_address",
dest="remote_host_address",
help="R
In article ,
MRAB wrote:
>On 10/09/2012 20:39, Wanderer wrote:
>>
>> I have an array generated by audiolab of left and right stereo
>> channels. It looks like [[1,1],[1,2],[2,3]]. I would like to combine
>> the left and right channels to get an array [2,3,5]. Is there a numpy
>> command to do tha
> Is there a simpler way to modify all arguments in a function before using the
> arguments?
You can use a decorator:
from functools import wraps
def fix_args(fn):
@wraps(fn)
def wrapper(*args):
args = (arg.replace('_', '') for arg in args)
return fn(*args)
return wr
Chris Angelico writes:
> Contrived example:
> def send_email(from, to, subj, body, whatever, other, headers, you, like):
That should be a dictionary with the header names as indexes. In fact
there are already some email handling modules in the stdlib that
represent headers that way.
--
http://m
On Sat, Nov 10, 2012 at 1:52 PM, Paul Rubin wrote:
> bruceg113...@gmail.com writes:
>> Is there a simpler way to modify all arguments in a function before
>> using the arguments?
>
> Why do you want to do that?
>
Contrived example:
def send_email(from, to, subj, body, whatever, other, headers, y
bruceg113...@gmail.com writes:
> Is there a simpler way to modify all arguments in a function before
> using the arguments?
Why do you want to do that?
> For example, can the below code, in the modify arguments section be
> made into a few statements?
Whenever someone uses that many variables on
On Fri, 09 Nov 2012 20:05:26 -0500, Roy Smith wrote:
> In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>,
> bruceg113...@gmail.com wrote:
>
>> Is there a simpler way to modify all arguments in a function before
>> using the arguments?
>>
>> For example, can the below code, in t
In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>,
bruceg113...@gmail.com wrote:
> Is there a simpler way to modify all arguments in a function before using the
> arguments?
>
> For example, can the below code, in the modify arguments section be made into
> a few statements?
On Sat, Nov 10, 2012 at 11:00 AM, Jeff Jeffries
wrote:
> Smart people, Is there a way I can add a dictionaries keys to the python
> namespace? It would just be temporary as I am working with a large
> dictionary, and it would speed up work using an IDE. I look and find
> nothing... none of the ke
Is there a simpler way to modify all arguments in a function before using the
arguments?
For example, can the below code, in the modify arguments section be made into a
few statements?
def someComputation (aa, bb, cc, dd, ee, ff, gg, hh):
# modify arguments
# ---
In article ,
Thomas Rachel
wrote:
>Am 11.09.2012 05:46 schrieb Steven D'Aprano:
>>
>> Good for you. (Sorry, that comes across as more condescending than it is
>> intended as.) Monkey-patching often gets used for quick scripts and tiny
>> pieces of code because it works.
>>
>> Just beware that if
On 11/9/2012 8:13 AM, Helmut Jarausch wrote:
Just for the record.
I first discovered a real bug with Python3 when using os.walk on a file system
containing non-ascii characters in file names.
I encountered a very strange behavior (I still would call it a bug) when trying
to put non-ascii charac
> local$ fab remote_info
> [remote] Executing task 'remote_info'
> [remote] run: uname -a
> [remote] out: remote@path$
What happens when you ssh to the machine and run 'uname -a'?
(The out: ... is the output)
--
http://mail.python.org/mailman/listinfo/python-list
> Try with just --trace?
>
>
> C:\ramit>python.exe -m trace test.py
> C:\ramit\Python27\lib\trace.py: must specify one of --trace, --count,
> --report, --listfuncs, or --trackcalls
>
> C:\ramit>python -m trace --trace test.py
> --- modulename: test, funcname:
> test.py(2): def f():
> test.py(5):
Hi,
I'm trying to use fabric to run a command on another Linux machine.
When I call "fab remote_info" (using the example from its
documentation), this is what I get:
local$ fab remote_info
[remote] Executing task 'remote_info'
[remote] run: uname -a
[remote] out: remote@path$
That is, it logs in
On Nov 9, 2012, at 3:43 PM, Jean Dubois wrote:
>
> The error may be obvious but finding this file and how to install it
> is not unfortunately.
> It seems I have to install it from the National Instruments site but
> Debian Linux doesn't seem to be supported...
> and I doubt whether just copying
On Fri, Nov 9, 2012 at 2:46 PM, danielk wrote:
> D:\home\python>pytest.py
> Traceback (most recent call last):
> File "D:\home\python\pytest.py", line 1, in
> print(chr(253).decode('latin1'))
> AttributeError: 'str' object has no attribute 'decode'
>
> Do I need to import something?
Ramit
Prasad, Ramit wrote:
Dennis Lee Bieber wrote:
Of course, if one has a language that, for some reason, evaluates
right-to-left (APL, anyone), then
x := x - x - x
becomes
x := x - 0
Is that not the same as x:=-x?
No, its the same as 'x = x'.
~Ethan~
--
http://mail.p
On Friday, November 9, 2012 4:34:19 PM UTC-5, Prasad, Ramit wrote:
> danielk wrote:
>
> >
>
> > The database I'm using stores information as a 3-dimensional array. The
> > delimiters between elements are
>
> > chr(252), chr(253) and chr(254). So a record can look like this (example
> > only u
On 2012.11.09 15:17, danielk wrote:
> I guess the question I have is: How do you tell Python to use a specific
> encoding for 'print' statements when I know there will be characters outside
> of the ASCII range of 0-127?
You don't. It's raising that exception because the terminal cannot
display t
danielk wrote:
>
> The database I'm using stores information as a 3-dimensional array. The
> delimiters between elements are
> chr(252), chr(253) and chr(254). So a record can look like this (example only
> uses one of the delimiters for
> simplicity):
>
> name + chr(254) + address + chr(254) +
Peng Yu wrote:
>
> > Is this what you want?
> > http://docs.python.org/2/library/trace.html
>
> I'm not able to get the mixing of the python command screen output on
> stdout. Is there a combination of options for this purpose?
>
> ~/linux/test/python/man/library/trace$ cat main1.py
> #!/usr/bin
On Friday, November 9, 2012 12:48:05 PM UTC-5, Dave Angel wrote:
> On 11/09/2012 12:17 PM, danielk wrote:
>
> > I'm converting an application to Python 3. The app works fine on Python 2.
>
> >
>
> > Simply put, this simple one-liner:
>
> >
>
> > print(chr(254))
>
> >
>
> > errors out with:
>
Jean Dubois wrote:
>
> On 9 nov, 17:40, Rodrick Brown wrote:
> > It seems pretty obvious from the error. Try installing the missing lib
> > packages.
> >
> > OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
> > object file: No such file or directory
> >
> > Sent from my iPho
> Is this what you want?
> http://docs.python.org/2/library/trace.html
I'm not able to get the mixing of the python command screen output on
stdout. Is there a combination of options for this purpose?
~/linux/test/python/man/library/trace$ cat main1.py
#!/usr/bin/env python
def f():
print "Hel
On 9 nov, 17:40, Rodrick Brown wrote:
> It seems pretty obvious from the error. Try installing the missing lib
> packages.
>
> OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
> object file: No such file or directory
>
> Sent from my iPhone
>
> On Nov 9, 2012, at 11:22 AM, Je
Dennis Lee Bieber wrote:
>
> On Fri, 9 Nov 2012 17:07:09 +1100, Chris Angelico
> declaimed the following in gmane.comp.python.general:
>
> > On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence
> > wrote:
> > > On 07/11/2012 01:55, Steven D'Aprano wrote:
> > >>
> > >>
> > >> Who knows? Who cares? No
duck(Foo).match(IFoo, )
duck(Foo).like(IFoo, )
Hm... function name in most cases is read as verb... this may cause confusion:
duck => synonyms => immerse, dip
Thanks.
Andriy Kornatskyy
> From: ramit.pra...@jpmorgan.com
> To: andriy.kornats...@live.com;
Chris Angelico wrote:
>
> What you really should be doing is not transforming the whole
> structure, but explicitly transforming each part inside it. I
> recommend you stop fighting the language and start thinking about your
> data as either *bytes* or *characters* and using the appropriate data
>
On 11/09/2012 12:17 PM, danielk wrote:
> I'm converting an application to Python 3. The app works fine on Python 2.
>
> Simply put, this simple one-liner:
>
> print(chr(254))
>
> errors out with:
>
> Traceback (most recent call last):
> File "D:\home\python\tst.py", line 1, in
> print(chr(25
On 2012.11.09 11:17, danielk wrote:
> I'm converting an application to Python 3. The app works fine on Python 2.
>
> Simply put, this simple one-liner:
>
> print(chr(254))
>
> errors out with:
>
> Traceback (most recent call last):
> File "D:\home\python\tst.py", line 1, in
> print(chr(2
Andriy Kornatskyy wrote:
>
> Thank you for all comments.
>
> > It makes very good sense to say:
> >
> > duckmatch(IFoo).compare(Foo)
>
> Since we do duck match of IFoo... but there is no `duck match`, there is
> `duck test`. I believe instead of
> `compare` is more readable with `equals`. Than
On Fri, Nov 9, 2012 at 10:17 AM, danielk wrote:
> I'm converting an application to Python 3. The app works fine on Python 2.
>
> Simply put, this simple one-liner:
>
> print(chr(254))
>
> errors out with:
>
> Traceback (most recent call last):
> File "D:\home\python\tst.py", line 1, in
> pr
On Fri, Nov 9, 2012 at 2:18 AM, Helmut Jarausch
wrote:
> Hi,
>
> probably I'm missing something.
>
> Using str(Arg) works just fine if Arg is a list.
> But
> str([],encoding='latin-1')
>
> gives the error
> TypeError: coercing to str: need bytes, bytearray or buffer-like object,
>
Graham Fielding wrote:
>
> Hey, folks, me again!
>
> I've been puzzling over this for a while now:
>
> I'm trying to write data to a file to save the state of my game using the
> following function:
>
> def save_game():
> #open a new empty shelve (possibly overwriting an old one) to write
I'm converting an application to Python 3. The app works fine on Python 2.
Simply put, this simple one-liner:
print(chr(254))
errors out with:
Traceback (most recent call last):
File "D:\home\python\tst.py", line 1, in
print(chr(254))
File "C:\Python33\lib\encodings\cp437.py", line 19,
Helmut Jarausch, 09.11.2012 14:13:
> On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote:
>> What you really should be doing is not transforming the whole
>> structure, but explicitly transforming each part inside it. I
>> recommend you stop fighting the language and start thinking about your
On 11/9/2012 1:30 AM, Steven D'Aprano wrote:
On Thu, 08 Nov 2012 23:44:54 -0500, Terry Reedy wrote:
On 11/8/2012 6:40 PM, Steven D'Aprano wrote:
[...]
IFoo.bar # returns a computed property
Assuming IFoo is a class and bar is a property attribute of the class,
IFoo.bar is the property obje
Friends,
I am in process learning python.
I basically use shell scripts for text formatting and trying my hand on
python.
where I am fighting is awk's functionality in python.
Say, one of my real tiny code looks like:
#!/bin/bash
TMP=store
for i in $1/MnBi_EOS_*
do
# echo $i
grep -A 15 "T(est)"
It seems pretty obvious from the error. Try installing the missing lib packages.
OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared
object file: No such file or directory
Sent from my iPhone
On Nov 9, 2012, at 11:22 AM, Jean Dubois wrote:
> OSError: /usr/local/vxipnp/linux/
On Fri, Nov 9, 2012 at 4:37 AM, Steven D'Aprano
wrote:
> In Python 3.3:
>
> py> class X(int):
> ... def __init__(self, *args):
> ... super().__init__(*args) # does nothing, call it anyway
> ...
> py> x = X(22)
> Traceback (most recent call last):
> File "", line 1, in
> File "",
I'm trying to control a programmable power supply via USB using
python.
After doing some googling I thought I should use PyVisa for this
purpose, so I installed it as follows:
tar xvfz PyVISA-1.4.tar.gz
cd PyVISA-1.4
python setup.py install
Installation seems to finish without errors.
When I star
On Sat, Nov 10, 2012 at 2:05 AM, rusi wrote:
> In x86 assembler
> mov ax, 0
> is 4 bytes
Three bytes actually, B8 00 00 if my memory hasn't failed me. BA for
DX, B9 ought to be BX and BB CX, I think. But yes, the xor or sub is
two bytes and one clock.
ChrisA
--
http://mail.python.org/mailman/li
On Nov 9, 11:37 am, Steven D'Aprano wrote:
> On Fri, 09 Nov 2012 17:07:09 +1100, Chris Angelico wrote:
> > On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence
> > wrote:
> >> On 07/11/2012 01:55, Steven D'Aprano wrote:
>
> >>> Who knows? Who cares? Nobody does:
>
> >>> n -= n
>
> >> But I've seen this
There is sense for #2. Let me explain. There is basic IFoo implementation and
improved Foo. While I switched to Foo, I still want to be as close to IFoo as
possible, since there might be sense to switch to Foo2 later, which conform to
IFoo.
Here is the problem: if I will not assert #2 potentia
On Sat, Nov 10, 2012 at 1:01 AM, Andriy Kornatskyy
wrote:
>
> 1. In looks-like we check features of Foo (that may be superset) of what IFoo
> offers.
>
> assert looks(Foo).like(IFoo)
>
> 2. We can check if Foo is limited to IFoo only:
>
> assert looks(IFoo).like(Foo)
>
> So it valid to have both
Actually this one.. and its the last..
On Fri, Nov 9, 2012 at 2:59 PM, inshu chauhan wrote:
> Please Ignore the above two files attached,,, See this one
>
>
> On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan wrote:
>
>> I attached a wrong file...Right file is attached here
>>
>>
>> On Fri, Nov 9,
1. In looks-like we check features of Foo (that may be superset) of what IFoo
offers.
assert looks(Foo).like(IFoo)
2. We can check if Foo is limited to IFoo only:
assert looks(IFoo).like(Foo)
So it valid to have both asserts.
Thanks.
Andriy Kornatskyy
-
Please Ignore the above two files attached,,, See this one
On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan wrote:
> I attached a wrong file...Right file is attached here
>
>
> On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan wrote:
>
>>
>>
>>
>>
>> http://www.ymlgroup.com/obscurehiddenlocation/down
On Nov 9, 5:54 pm, Artie Ziff wrote:
> Hello,
>
> I want to process XML-like data like this:
> Edits were substituting '/' for '\' on the end tags, and adding the
> following structure:
If thats all you want, you can try the following:
# obviously this should come from a file
input= """
On Thu, 08 Nov 2012 18:00:58 -0700, Ian Kelly wrote:
> On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano
> wrote:
>> On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote:
>>
>>> People who come from strongly typed languages that offer interfaces
>>> often are confused by lack of one in Pytho
Am 09.11.2012 12:37, schrieb Steven D'Aprano:
On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote:
Or, do you suggest I don't call super().__init__()? That would seem
unclean to me.
On the contrary: calling super().__init__ when the superclass does
something you don't want (i.e. raises a
On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote:
> On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch
> wrote:
>> For me it's not funny, at all.
>
> His description "funny" was in reference to the fact that you
> described this as a bug. This is a heavily-used mature language; bugs
> as f
Hello,
I want to process XML-like data like this:
ACPI (Advanced Control Power & Integration) testscript for 2.5
kernels.
<\description>
ltp/testcases/kernel/device-drivers/acpi/ltpacpi.sh
<\test_location>
<\testname>
After m
On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch
wrote:
> For me it's not funny, at all.
His description "funny" was in reference to the fact that you
described this as a bug. This is a heavily-used mature language; bugs
as fundamental as you imply are unlikely to exist (consequences of
design de
I attached a wrong file...Right file is attached here
On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan wrote:
>
>
>
>
> http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and
>> imported it using from notzanzibar import DataType.
>>
>
> No i haven't downloaded it.. and this site is no
On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote:
> Am 08.11.2012 21:29, schrieb Terry Reedy:
>> On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
>> wrote:
On 3.3, it gives me a "TypeError: object.__init__() takes no
parameters". To some extent, this makes sense to me, because t
On 7/11/12 01:13:47, Steven D'Aprano wrote:
> On Tue, 06 Nov 2012 23:08:11 +, Prasad, Ramit wrote:
>
>> Steven D'Aprano wrote:
>>>
>>> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote:
>>>
> To enter the newline, I typed Ctrl-Q to tell bash to treat the next
> character as a lit
On Fri, 09 Nov 2012 10:49:41 +0100, Hans Mulder wrote:
> On 6/11/12 23:50:59, Steven D'Aprano wrote:
>> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote:
>>
To enter the newline, I typed Ctrl-Q to tell bash to treat the next
character as a literal, and then typed Ctrl-J to get a
Am 31.10.2012 06:39 schrieb Robert Miles:
For those of you running Linux: You may want to look into whether
NoCeM is compatible with your newsreader and your version of Linux.
This sounds as if it was intrinsically impossible to evaluate NoCeMs in
Windows.
If someone writes a software for
On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote:
> Helmut Jarausch, 09.11.2012 10:18:
>> probably I'm missing something.
>>
>> Using str(Arg) works just fine if Arg is a list.
>> But
>> str([],encoding='latin-1')
>>
>> gives the error
>> TypeError: coercing to str: need bytes, bytea
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and
> imported it using from notzanzibar import DataType.
>
No i haven't downloaded it.. and this site is not opening...
>
> Then you'd have instantiated it in some code like
> data = DataType(filename)
>
> and then the type of dat
Hi list,
I've these two minor problems which bothered me for quite some time,
maybe you can help me. I'm using Python 3.2.
For some project I have a component in its own package. Let's say the
structure looks like this:
pkg/__init__.py
pkg/Foo.py
pkg/Bar.py
Foo.py and Bar.py contain their class
Thank you for all comments.
> It makes very good sense to say:
>
> duckmatch(IFoo).compare(Foo)
Since we do duck match of IFoo... but there is no `duck match`, there is `duck
test`. I believe instead of `compare` is more readable with `equals`. Than it
is more from mathematics - precise answer
> To: python-list@python.org
> From: breamore...@yahoo.co.uk
> Subject: Re: Writing game-state data...
> Date: Fri, 9 Nov 2012 07:37:56 +
>
> On 09/11/2012 07:20, Graham Fielding wrote:
> >
> > Hey, folks, me again! I've been puzzling over this for a while now: I'm
> > trying to write data
Le jeudi 8 novembre 2012 21:42:58 UTC+1, Ian a écrit :
> On Thu, Nov 8, 2012 at 12:54 PM, wrote:
>
> > Font has nothing to do here.
>
> > You are "simply" wrongly encoding your "unicode".
>
> >
>
> '\u2013'
>
> > '–'
>
> '\u2013'.encode('utf-8')
>
> > b'\xe2\x80\x93'
>
> '\
On 6/11/12 23:50:59, Steven D'Aprano wrote:
> On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote:
>
>>> To enter the newline, I typed Ctrl-Q to tell bash to treat the next
>>> character as a literal, and then typed Ctrl-J to get a newline.
>>
>> That sounds complicated, my version of bash let
Helmut Jarausch, 09.11.2012 10:18:
> probably I'm missing something.
>
> Using str(Arg) works just fine if Arg is a list.
> But
> str([],encoding='latin-1')
>
> gives the error
> TypeError: coercing to str: need bytes, bytearray or buffer-like object,
>list found
>
> If this is
Hi,
probably I'm missing something.
Using str(Arg) works just fine if Arg is a list.
But
str([],encoding='latin-1')
gives the error
TypeError: coercing to str: need bytes, bytearray or buffer-like object,
list found
If this isn't a bug how can I use str(Arg,encoding='latin-1')
Am 08.11.2012 21:29, schrieb Terry Reedy:
On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
wrote:
On 3.3, it gives me a "TypeError: object.__init__() takes no
parameters". To some extent, this makes sense to me, because the
int subobject is not initialized in __init__ but in __new__. As a
workar
On Fri, Nov 9, 2012 at 12:20 AM, Graham Fielding wrote:
> file_object = open('savegame.sav', 'wb')
Here you open a file and assign it to "file_object".
> file['map'] = map
Here you attempt to write to "file" instead of "file_object". "file"
is the name of a built-in type, hence your e
74 matches
Mail list logo