Hello all,
I need to create 6 buffers in python and keep track of it.
I need to pass this buffer, say buffer 1 as an index to a test app. Has
any one tried to do this. Any help with buffer management appreciated.
Thanks,
-Joe
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
I which context is the inbuilt function buffer() used ?
regards,
KM
--
http://mail.python.org/mailman/listinfo/python-list
You'll probably want to be more specific. First thing that comes to
mind is how do you plan on passing the `buffer' to your `test app'. I
can think of a couple of ways off hand -- socket, stdin or maybe as a
command line argument.
If you're doing one of those, then I don
[EMAIL PROTECTED] wrote:
> Hello all,
>
> I need to create 6 buffers in python and keep track of it.
> I need to pass this buffer, say buffer 1 as an index to a test app. Has
> any one tried to do this. Any help with buffer management appreciated.
Use the module array.
--
R
Each buffer need to hold 512 bytes of data.
Thanks,
-Joe
--
http://mail.python.org/mailman/listinfo/python-list
the address of a variable or a class ?
read abt buffers as a refernce to a buffer object.
actually i tried passing list and dict types to buffer function, but only with string type i could createa buffer reference,
>>>y = 'GATCGTACC'
>>>x = buffer(y, 0,8)
>>> x
&g
Thus spake km ([EMAIL PROTECTED]):
> I which context is the inbuilt function buffer() used ?
It's an efficiency measure. Say you have a string x. Taking
a slice of the string - x[a:a+10] - will implicitly create a
new string containing the specified data. Doing the same
using buffer -
Hello,
How does Python deal with C type memory buffers. Does Python return
everything as an object irrespective of the data type?
Here's what i am trying to achieve?
testCode(unsigned char buf, unsigned long len)
{
unsigned long data=0x0;
while (len--)
{
*buf++ = (unsigned ch
Hey,
Has anyone ever had commands.getstatusoutput's buffer fill up when
executing a verbose command? If so, what workaround did you use?
Did you just pipe the output into a file and then read it in or
fork a processes or something else?
--
Regards,
Travis Spencer
--
http://mail.pytho
Is there a way that using Tkinter I can pre-render the canvas then draw
it on the screen?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
km wrote:
>
> Hi all,
>
> was looking at references in python...
> >>> a = 10
> >>> b = a
> >>> id(a)
> 153918788
> >>>id(b)
> 153918788
>
> where a and b point to the same id. now is this id an address ?
no, it's the object identity, and all it tells you is that both names
point to the s
ar to the address of a variable or a class ?
Exactly. Similar. Not the same, but similar.
> read abt buffers as a refernce to a buffer object.
> actually i tried passing list and dict types to buffer function, but only
> with string type i could createa buffer reference,
> >>
Hi all,
in the CPython implementation, it's the address where the object isstored. but that's an implementation detail.
ok so can i point a vairiable to an address location just as done in C language ?
>>> y = 'ATGCATGC'
>>> x = buffer(y)
>>> del(
Fredrik Lundh wrote:
[snip]
>> is id similar to the address of a variable or a class ?
>
> in the CPython implementation, it's the address where the object is
> stored. but that's an implementation detail.
Just as an obscure sidenote, in PyPy it is ~address some of the time.
This is due to the fa
km wrote:
> ok so can i point a vairiable to an address location just as done in C
> language ?
no. there are no C-style "variables" in Python; just objects and names
bound to objects. Python variables are names, not memory locations.
> >>> y = 'ATGCATGC
> language ?
> >>> y = 'ATGCATGC'
> >>> x = buffer(y)
> >>> del(y)
> >>> x
>
> >>> print x
> ATGCATGC
>
> now even when i delete y, why is that x still exists ?
Say that you copy the contents of file
km wrote:
> Hi all,
>
> in the CPython implementation, it's the address where the object is
> stored. but that's an implementation detail.
>
>
> ok so can i point a vairiable to an address location just as done in C
> language ?
> >>>
Hi all,Say that you copy the contents of file foo into file bar and delete
the original foo. Of course file bar still exists in this case. Notmuch of a difference; I haven't seen buffer objects yet (I am also newto Python), but the initialization for the buffer probably copieswhatever is
On 10/8/06, km <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>
> > Say that you copy the contents of file foo into file bar and delete
> > the original foo. Of course file bar still exists in this case. Not
> > much of a difference; I haven't seen buffer objects yet
Hi all,
Congratulations, you understand both Hinduism and Python better than Ido now. :)
c.f.http://www.swami-krishnananda.org/brdup/brhad_III-09.html"Kati references, Yajnavalkya, iti?"
the answer lies in a single line as pronounced by sri adi sankaracharya -
"aham bramhasmi sivoha sivoham "
km wrote:
> why is that python doesnt implement direct memory addressing provided a
> reference to an object exists ?
because Python is a portable high-level language. if you want
assembler, you shouldn't use Python.
did you read the "reset your brain" article ?
--
http://mail.python.org/
Hi,
I have an application that reads video from a socket and saves it to a file,
which I then play using GStreamer. The major problem with this approach is
that the file keeps getting bigger and bigger until the disk is full ;-)
What I'd like to do is have a buffer, say 5MB in size, wh
responses from that hardware.
When a timeout happens, for some reason extra data is stored inside
the buffer, so when the timeout is over, that extra data (remember this
data is instructions) is executed by the hardware, which I don't want.
For timeout purposes, I want the socket to be nonblo
izer class (which is ugly) or use two tokenizers on the same data
buffer (which seems impossible to me using my preferred approach as a
file-like object has exactly one file pointer).
Is there a way for multiple StringIO objects to share a buffer of data, or
do I have to give up on subclassing StringI
Hi All--
def testCode(data):
buf=data[:]
# and I hope you're going to do something with buf,
# because otherwise this function's a bit of a waste;-)
"[EMAIL PROTECTED]" wrote:
>
> Hello,
>
> How does Python deal with C type memory buffers. Does Python return
> everything as an object i
Joe:
> testCode(unsigned char buf, unsigned long len)
> {
> unsigned long data=0x0;
> while (len--)
> {
> *buf++ = (unsigned char)data++
This C code will crash since buf is declared as an unsigned char, not
an unsigned char*. Stop thinking in terms of translating low level
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
> What's the best way to deal with this in python?
I can't tell what you're trying to do. If you want an array
containing the numbers 0,1,...,n-1, just say
buf = range(n)
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Jul 20, 2005 at 03:10:49PM -0700, [EMAIL PROTECTED] wrote:
> Hey,
>
> Has anyone ever had commands.getstatusoutput's buffer fill up when
> executing a verbose command? [...]
How much output are you talking about? I tried outputs as large as
about 260 megabytes wi
Jeff Epler wrote:
> On Wed, Jul 20, 2005 at 03:10:49PM -0700, [EMAIL PROTECTED] wrote:
> How much output are you talking about?
Honestly, I don't know. I came on to a project were they said they
were hitting up against some limit, and had a hack to work around it.
I just wondered if others had hi
[EMAIL PROTECTED] wrote:
> Is there a way that using Tkinter I can pre-render the canvas then draw
> it on the screen?
not really; the canvas is double-buffered, but it regenerates (portions of) the
buffer when necessary.
if you want to draw in a separate buffer, and use that when updati
Hi,
I'm trying to proxy all keys typed by the user to a process spawned via
popen2. Unfortunately, I figured out that I can't control really
interactive applications such as mc or aptitude.
All user input seems to be line buffered.
http://pexpect.sourceforge.net/ has some words about the situatio
In <[EMAIL PROTECTED]>, David Johnson
wrote:
> What I'd like to do is have a buffer, say 5MB in size, which I can point
> GStreamer at. So every time I write 60K to the tail of the file, I'd need to
> remove 60K from the head of the file.
You can't remove dat
David Johnson wrote:
> I have an application that reads video from a socket and saves it to a
> file, which I then play using GStreamer. The major problem with this
> approach is that the file keeps getting bigger and bigger until the disk
> is full ;-)
>
> What I'd like
ece of hardware, and data recieved is just
> responses from that hardware.
> When a timeout happens, for some reason extra data is stored inside
> the buffer, so when the timeout is over, that extra data (remember this
> data is instructions) is executed by the hardware, which I don
s sent to the device
>is instructions for that piece of hardware, and data recieved is just
>responses from that hardware.
> When a timeout happens, for some reason extra data is stored inside
>the buffer, so when the timeout is over, that extra data (remember this
>data is instructi
Thomas Lotze wrote:
> Is there a way for multiple StringIO objects to share a buffer of
> data, or do I have to give up on subclassing StringIO for this
> purpose? (An alternative would be a tokenizer class that has a
> StringIO instead of being one and do the file pointer housekeepin
How does one transfer a buffer object from python -> c and back again
(assuming the data gets modified)?
I can't seem to get this or anything else to work, but am clueless as
to what I'm doing wrong
using namespace boost::python;
static PyObject * proc_buf(PyObject *self, P
Are there runtime settings that can be used to adjust the default 1024
byte stdin buffer limit or a buildtime setting in pyconfig.h? I have a
need to pump this up to permit input of a large data block via stdin.
Tim Jones
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> How does one transfer a buffer object from python -> c and back again
> (assuming the data gets modified)?
> I can't seem to get this or anything else to work, but am clueless as
> to what I'm doing wrong
>
>
> using namespace boo
John Machin wrote:
> [EMAIL PROTECTED] wrote:
> > How does one transfer a buffer object from python -> c and back again
> > (assuming the data gets modified)?
> > I can't seem to get this or anything else to work, but am clueless as
> > to what I'm doing
[EMAIL PROTECTED] wrote:
> This is the part I need help with. I've also used PyBuffer_...
> subroutines which gave similar problems. Thanks for all of your other
> comments, but I was hoping someone could just tell me what was wrong
> with the code without having to worry about all of the other
Strange request, but is there any way to get text into the linux
copy-paste buffer from a python script ?
I know the standard python libraries won't have that functionality
(except as a side-effect, perhaps?), but is there a simple trick that
would do it on linux? A command line to get
"brucoder" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Are there runtime settings that can be used to adjust the default 1024
> byte stdin buffer limit or a buildtime setting in pyconfig.h? I have a
> need to pump this up to permit input of a large da
Currently, when sending a data stream that exceeds 1024 bytes via
stdin, the stream blocks at the 1024th byte. This precludes completion
of the submission of the data stream.
Tim
--
http://mail.python.org/mailman/listinfo/python-list
Currently, when sending a data stream that exceeds 1024 bytes via
stdin, the stream blocks at the 1024th byte. This precludes completion
of the submission of the data stream.
Tim
--
http://mail.python.org/mailman/listinfo/python-list
brucoder wrote:
Currently, when sending a data stream that exceeds 1024 bytes via
stdin, the stream blocks at the 1024th byte. This precludes completion
of the submission of the data stream.
But surely the blocking will only last as long as the consuming process
leaves buffered input unread?
reg
"brucoder" <[EMAIL PROTECTED]> wrote:
> Currently, when sending a data stream that exceeds 1024 bytes via
> stdin, the stream blocks at the 1024th byte. This precludes completion
> of the submission of the data stream.
you can pass in a buffer size when you open a
g a data stream that exceeds 1024 bytes via
> > stdin, the stream blocks at the 1024th byte. This precludes
completion
> > of the submission of the data stream.
>
> you can pass in a buffer size when you open a file:
>
> >>> help(open)
>
&g
Hello !
How to increase buffer size of a file ?
I want to use more buffer, but I don't want to replace every file object
with my class.
It have a contant in a module ?
Thanks for your help:
dd
--
http://mail.python.org/mailman/listinfo/python-list
David Hirschfield wrote:
> Strange request, but is there any way to get text into the linux
> copy-paste buffer from a python script ?
>
> I know the standard python libraries won't have that functionality
> (except as a side-effect, perhaps?), but is there a simple trick t
ut is there any way to get text into the linux
copy-paste buffer from a python script ?
I know the standard python libraries won't have that functionality
(except as a side-effect, perhaps?), but is there a simple trick that
would do it on linux? A command line to get text into the buffer? U
Ah, indeed it does...my distro didn't have it, but a quick download and
compile and there it is.
Thanks a bunch,
-Dave
Keith Dart wrote:
On 9/5/06, David
Hirschfield <[EMAIL PROTECTED]>
wrote:
This is good info...but I'm
looking for the opposite direction: I want
to place so
durumdara wrote:
> How to increase buffer size of a file ?
> I want to use more buffer, but I don't want to replace every file object
> with my class.
the open() file factory takes the buffer size as an optional third
argument. see the documentation for details.
--
http://m
Hi listers,
I wrote this script in Zope some time ago and it worked for a while, but now
I'm getting the following error:
TypeError: coercing to Unicode: need string or buffer, NoneType found
Here's my script:
results = context.module_retriever().tuples() # call to ZSQLMethod
Hi,
I'm using Python with pygtk and have this problem - I have read the
contents of a file into the text buffer with this code,
infile = open("mytextfile", "r")
if infile:
string = infile.read()
infile.close()
textbuff
Jon Bowlas wrote:
> Here's my script:
>
> results = context.module_retriever().tuples() # call to ZSQLMethod
> converted = []
> for result in results:
>result = list(result) # make a list from the tuple
>for i in range(len(result)):
> # for each element in the listified tuple, make de
Ahh, that did it, thanks very much.
Jon
- Original Message -
From: <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Thursday, July 27, 2006 11:19 AM
Subject: Re: coercing to Unicode: need string or buffer, NoneType found
>
> Jon Bowlas wrote:
>
>
Jon Bowlas wrote:
> I wrote this script in Zope some time ago and it worked for a while, but
> now I'm getting the following error:
> TypeError: coercing to Unicode: need string or buffer, NoneType found
>
> Here's my script:
>
> results = context.module
Ahh yes there are a couple of dodgy records that seem to have been added.
many thanks.
Jon
- Original Message -
From: "Peter Otten" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Thursday, July 27, 2006 11:22 AM
Subject: Re: coercing to Unicode: need
It says line 8 in the traceback so I guess its
result[i] = unicode(result[i], 'latin-1')
Jon
- Original Message -
From: "Sybren Stuvel" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Thursday, July 27, 2006 11:06 AM
Subject: Re: coercing to Unic
On Sat, 17 Feb 2007 15:47:20 -0800, google wrote:
> As a test, I tried to write the buffer back to a file with this code
> but did not work,
Oooh, guessing games! I love guessing games!
Let me see... did it reboot your PC?
Did Python crash?
Did you get an exception? Maybe something abo
En Sat, 17 Feb 2007 20:47:20 -0300, <[EMAIL PROTECTED]> escribió:
> I'm using Python with pygtk and have this problem - I have read the
> contents of a file into the text buffer with this code,
>
> infile = open("mytextfile", "r")
>
I just included file opening code just to show how i read the file
into the text buffer - I have no issues with this as such. Problem is
only with the writing of the text buffer back to a file. When I try to
write the buffer to a file it gave the following,
Traceback (most recent call last
On Feb 18, 1:14 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sat, 17 Feb 2007 15:47:20 -0800, google wrote:
> > As a test, I tried to write the buffer back to a file with this code
> > but did not work,
>
> Oooh, guessing games! I love guessing games!
Goo
On Sat, 17 Feb 2007 17:19:06 -0800, google wrote:
>> Did you get an exception? Maybe something about not being able to open
>> the file for reading? Or perhaps disk full?
>
> File read ok for input, its the file write thats the problem
Well, duh. I know that -- that's what your first email said.
On Sat, 17 Feb 2007 17:10:50 -0800, google wrote:
> I just included file opening code just to show how i read the file
> into the text buffer - I have no issues with this as such. Problem is
> only with the writing of the text buffer back to a file. When I try to
> write the buffer
where - thats why I asked for the groups
help.
Anyway, thanks to all that replied via emailed and in this group.
On Feb 18, 7:34 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sat, 17 Feb 2007 17:10:50 -0800, google wrote:
> > I just included file opening code just to show
first, I'm try the POINTER to convesion the pointer type. but failed.
class STUDENT(Structure):
_fields_ = [('name', c_int),
('id', c_int),
('addition',c_ubyte)]
buffer = c_byte * 1024
student_p = cast(buffer,
i truly didn't understand this error :Traceback (most recent call last): File "D:\Programmation\FrancePaquet\FrancePaquet.py", line 77, in ? cabtri = "zz" + chiffrescabtri + clefcTypeError: coercing to Unicode: need string or buffer, int found
>>> if someone
Hello
invoking something like following -
sock.send(100)
generates the following error -
TypeError: send() argument 1 must be string or read-only buffer,
not int
how can I work around this? I wish to write
msg-length on a stream socket.
thanks in advance.
manish
--
http
Hi,
When working in the python command shell, I often end up writing more
than 10+ lines of indented code before making a stupid typo. This got
irritating enough for me to do something about it. So, here's an
'InteractiveConsole with an editable buffer'.
http://aspn.activestate.co
I read a file into a buffer and subject it to re.sub()
I can replace every occurrence of a pattern with a fixed string but when
I try to replace each occurrence with a string that changes (by having
an incrementing number in it, (ie 'repTxt[1]','repTxt[2]'etc), I note
that the
人言落日是天涯,望极天涯不见家 wrote:
> first, I'm try the POINTER to convesion the pointer type. but failed.
>
> class STUDENT(Structure):
> _fields_ = [('name', c_int),
> ('id', c_int),
> ('addition',c_u
', c_int),
> > ('id', c_int),
> > ('addition', c_ubyte)]
>
> > buffer = c_byte * 1024
> > student_p = cast(buffer, POINTER(STUDENT))
>
> > The parameter of the POINTER must be ctypes type.
> > How coul
> cabtri = "zz" + chiffrescabtri + clefc
> TypeError: coercing to Unicode: need string or buffer, int found
>
> def calculclef(nombre):
> if clef == 10:
> clef = 0
> return clef
>
> clefb = calculclef(debutplage)
>
"bussiere maillist" wrote:
>i truly didn't understand this error :
> Traceback (most recent call last):
> File "D:\Programmation\FrancePaquet\FrancePaquet.py", line 77, in ?
>cabtri = "zz" + chiffrescabtri + clefc
> TypeError: coercing to Un
Manish Gupta wrote:
> invoking something like following -
>
> sock.send(100)
>
> generates the following error -
>
> TypeError: send() argument 1 must be string or read-only buffer, not int
>
> > how can I work around this? I wish to write
> msg-le
if you want to send the value '1000' over a socket connection in a
socket object do something like sock.send(str(1000)) if socket is a
socket.socket object.
--
http://mail.python.org/mailman/listinfo/python-list
Steve wrote:
> Hi,
> When working in the python command shell, I often end up writing more
> than 10+ lines of indented code before making a stupid typo. This got
> irritating enough for me to do something about it. So, here's an
> 'InteractiveConsole with an ed
m g william wrote:
> I read a file into a buffer and subject it to re.sub()
> I can replace every occurrence of a pattern with a fixed string but when
> I try to replace each occurrence with a string that changes (by having
> an incrementing number in it, (ie 'repTxt[1]',&
"m g william" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> #now replace all 'rng's with consecutive streams
> #===
> def static_num():
>''' this is a generator function that avoids globals
> yield differentiates fn as generator fn w
SECURITY ADVISORY [PSF-2006-001]
Buffer overrun in repr() for UCS-4 encoded unicode strings
http://www.python.org/news/security/PSF-2006-001/
Advisory ID: PSF-2006-001
Issue Date: October 12, 2006
Product: Python
Versions: 2.2, 2.3, 2.4 prior to 2.4.4, wide unicode
On Thursday 12 October 2006 17:31, Anthony Baxter wrote:
>SECURITY ADVISORY [PSF-2006-001]
> Buffer overrun in repr() for UCS-4 encoded unicode strings
>
> http://www.python.org/news/security/PSF-2006-001/
As a few people noted in email to me - the patch direc
83 matches
Mail list logo