"blaine" schrieb
> >
> > while 1:
> > r = self.fifodev.readline()
> > if r: print r
> >
> > According to my docs, readline() returns an empty
> > string at the end of the file.
> > Also, you might want to sleep() between reads a
> > little bit.
> >
>
> Oh ok, that makes sense. Hmm. So do I n
"blaine" schrieb
>
> # Fake Nokia Screen Emulator
> import sys, os
>
> class nokia_fkscrn:
> def __init__(self, file):
> if not os.path.exists(file):
> os.mkfifo(file)
> self.fifodev = open(file, 'r')
> def read(self):
> while 1:
> r = self.fifodev.readline()
> p
"Istvan Albert" schrieb
>
> > Is subprocess.Popen completely broken?
>
> Your lack of faith in Python is somewhat
> disturbing ...
>
I have consistently made the experience that when
I was about to ask "is X completely broken", the
error was on my side.
Martin
--
http://mail.python.org/ma
"Marc 'BlackJack' Rintsch" schrieb
>
> > I don't think this qualifies as a bug, but I am astonished
> > that the struct module does not tell you whether you are
> > big endian, you have to find out yourself with
> >struct.unpack('@I', s)[0]==struct.unpack(">I", s)[0]
>
> Maybe a little more
"sturlamolden" schrieb
>
> > This seems to imply that the Mac, although running now
> > on Intel processors, is still big-endian.
>
> Or maybe the struct module thinks big-endian is native
> to all Macs? It could be a bug.
>
Dunno, I'm on thin ice here. Never used a Mac.
Maybe the underlying
"jasonwiener" schrieb
>
> I am having a VERY odd problem with unpacking right now.
> I'm reading data from a binary file and then using a very
> simple struct.unpack to get a long. Works fine on my MacBook,
> but when I push it to a Linux box,it acts differently and
> ends up pewking.
> [...]
"Colin J. Williams" schrieb
> The Library Reference has
> strip( [chars])
>
> Return a copy of the string with the
> leading and trailing characters removed.
It's "leading and trailing", not
"leading, trailing or embedded".
>>> "xxxaaaxxx".strip("x")
'aaa'
>>> "xxxaaax
"Stef Mientki" schrieb
> hello,
>
> I wonder if anyone has (good ;-) experiences
> with Python on a PDA ?
> And if so,
> - what OS
> - what GUI
>
Python runs here on:
- Sharp Zaurus SL-C3100 (with the exception of Tkinter)
(Linux 2.4)
- Mio A701
(Windows Mobile)
But I only do small stuf
"richie" schrieb
> > > That code works. Maybe you fixed it while
> > > you were mailing it =)
> >
> > This is weird mate.
> > I'm using eclipse 3.2 with the pydev plugin.
> > There it loops forever - from the eclipse console.
> > Two hours of trying, changing the code...finally gave up.
> >
> >
"Zbigniew Braniecki" schrieb
> I found a bug in my code today, and spent an hour trying to locate
it
> and then minimize the testcase.
> [...]
>def __init__ (self, val=[]):
> [...]
> Any clue on what's going on here, and/if where I should report it?
>
I think this has to do with
http://doc
"Madhur" schrieb
> I would like to know the best way of generating filter
> of two files based upon the following condition
> [...]
>
Sounds like homework. Here some suggestions:
- for each file, create a dictionary (see help(dict)
in the python shell for details) and populate it with
the values
"SMALLp" schrieb
> I have question. After short goggling, I haven't found
> anything good. So my question is:
> I wrote a program in python and i Get .py files and some
> .pyc in working folder. Now i want program tu run under
> windows, so i need to get exe files or something.
>
If python is
"Merrigan" schrieb im>
> I'm sure I have done this before, but cannot remember how,
> or find out how to do it quickly - but is there a
> way/function/something in python to make all the letters
> of a raw_input() string small/capital letters?
>
"upper might help".upper()
"OR LOWER".lower()
H
"Donn Ingle" schrieb
> Is there a way to get a dump of the insides of an object?
> I thought pprint would do it.
>
print would actually like to do it if you told it how to do it.
print actually does it, but takes a default implementation if
you do not override __repr__ or __str__.
> If I had a cl
"MonkeeSage" schrieb
> >
> > If I have understood python naming scoping correctly,
> > doing
> >my_var="hello"
> >import stuff
> >print my_var
> > is not the same as
> >my_var="hello"
> >exec open("stuff.py").read()
> >print my_var
> > with stuff.py containing
> >my_var
"Bruno Desthuilliers" schrieb
> >> I have a file that might contain literal python
> >> variable statements at every line. For example
> >> the file info.dat looks like this:
> >> users = ["Bob", "Jane"]
> >> status = {1:"ok",2:users[0]}
> >> the problem is I want to read this file and load
>
"Astan Chee" schrieb
> I have a file that might contain literal python
> variable statements at every line. For example
> the file info.dat looks like this:
> users = ["Bob", "Jane"]
> status = {1:"ok",2:users[0]}
> the problem is I want to read this file and load
> whatever variables written in
"Carsten Haese" schrieb
> > new to Fedora7, typed python in interactive interpreter, then
help().
> > Then modules to get a list of modules. Then module name to get
info
> > on a module but no help file. What is the help file name?
> > Is there an environmental variable I have to set?
>
> There i
"Flyzone"schrieb
> I'm trying to make work this code in python 2.2.3:
>
> check=datetime.datetime.today().strftime("%H%M")
>
> but datetime is not supported in that version but
> just in the later. I can't upgrade python, too many
> dependencies in a critical system.
> How can i convert that st
"W. Watson" schrieb
> I have about a 1600 line Pythron program I'd like to
> make some simple mods to, but have really just a nodding
> acquaintance with Python and Tkinter.
> [...]
> Let's change that.
>
The book "Learning Python" from O'Reilly is excellent.
If you are into scientific progr
"Steve Holden" schrieb
>
> I simply meant that the whole source has to be presented
> to the exec statement and not chunked into lines.
>
That's what I meant: With exec open(f).read() it is not
broken into several exec invocations.
>
> I was probably just a little over-zealous in pursuing
>
"Steve Holden" schrieb
> >
> > [ difference between exec open(fname).read()
> >and for line in open(fname): exec line ]
> >
> > So it seems to depend on the way the file is read.
> >
> It depends on the way the lines of the file are executed,
> not how they are read.
>
Could you elaborate
"Steve Holden" schrieb
> >>
> >> Try it on a file that reads something like
> >>
> >> xxx = 42
> >> print xxx
> >>
> >> and you will see NameError raised because the assignment
> >> hasn't affected the environment for the print statement.
> >>
> > [...]
> >
> No, because there isn't one. Now try
"tmp123" schrieb >
> We have very big files with python commands
> (more or less, 50 commands each file).
>
> It is possible to execute them command by command,
inp = open(cmd_file)
for line in inp:
exec line
might help. You don't get quite the same feeling as
"like if the commands wa
"7stud" schrieb
> How about:
>
> ---
> x = [0, 100, 200, 1000]
> y = -1
> inserted = False
>
> for i in range(len(x)):
> if(y <= x[i]):
> x.insert(i, y)
> inserted = True
> break
> if(not inserted): x.append(y)
>
> print x
> --
<[EMAIL PROTECTED]> schrieb
>>
>>> I have a function called 'test' defined in A.py.
>>> How can I call that function test in my another file B.py?
>>
>> In B.py:
>> import A
>> A.test()
>>
>
> But Do I need to put A.py and B.py in the same directory?
No, but then you have to take certain preca
<[EMAIL PROTECTED]> schrieb
>
> I have a function called 'test' defined in A.py.
> How can I call that function test in my another file B.py?
>
In B.py:
import A
A.test()
HTH
Martin
--
http://mail.python.org/mailman/listinfo/python-list
<[EMAIL PROTECTED]> schrieb
> I am trying to make a program that will basically simulate
> a chess clock in python. ...
> ... it crashes shortly after.
Can't help you on why it crashes, but
>
> class eventMonitor (Thread):
> def run ( self ):
> [snipped]
> if e
"bruno at modulix" schrieb
>
> [lucid introduction into decorators]
>
Thanks for the help in understanding decorators.
Martin
--
http://mail.python.org/mailman/listinfo/python-list
"bruno at modulix" schrieb
> >
> > Well, if you're changing the original module,
> Who's talking about "changing the original module" ?
>
Well, you have to apply @deco in the module where
func_to_decorated is placed.
>
> > Isn't the point of a decorator to change the
> > behavior externally,
"bruno at modulix" schrieb
>
> [snip]
>
> The use case for @decorator is for wrapping functions
> or method *in the module/class itself*.
That was the question. What's the use of doing it
like that in the module *itself* (I mean, you change
directly the original function)?
> It's not for modul
"Sybren Stuvel" schrieb
> Martin Blume enlightened us with:
Don't know if I enlightened anybody ... :-)
> > Another question: Isn't decorating / wrapping
> > usually done at runtime, so that the @deco
> > notation is pretty useless (because y
"bruno at modulix" schrieb
>
> What Python 2.4 adds is only syntactic sugar for decorators.
> You can do the same - somewhat more explicitely - in 2.3.
>
> > What is the decorator useful for?
>
>
> The whole things looks like this:
>
> def deco(func):
> print "decorating %s" % func.__name_
"Philippe Martin" schrieb
> Hi,
>
> This code works, but is it "appropriate" ?
>
> l_init = False
>
> if True == l_init and 1234 = l_value:
> print 'l_value is initialized'
>
> I know I can do this with a try but ...
>
I am a Python newbie, but I think working with
l_value = None
would be t
"Rob Cowie" schrieb
> Excellent... just the thing I was looking for. Thanks.
>
> Does anyone know of a unix app that could be used to
> monitor the duration of processes etc.?
>
man -k account showed me (among others):
acct (2) - switch process accounting on or off
acct (5)
"Enrique Palomo Jiménez"
>
> After ftp a file from mvs to windows, i find:
> is an offset, so up to 2GB, a commercial application
> drives crazy
> [...]
>
??? I didn't understand your question, but 2 GB is popular
limit for the maximal size of a file for some filesystems
(e.g. ext2, FAT [???]).
Ma
"Xah Lee" schrieb
>
> perhaps i'm tired, but why can't i run:
>
> t='m=3'
> print eval(t)
>
Perhaps you didn't read the documentation? :-)
Perhaps you didn't try hard enough?
C:\WINNT>c:\programme\python\python
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]
on win32
Type "hel
"Björn Lindström" schrieb
>
> > A great analysis, but what's a "pogo stick" and where can I get
one?
>
> http://search.ebay.com/pogo-stick
>
Yes, that explains the "bouncing with the pogo stick"; I would have
poked around
with a stick.
ROTFL, thank you.
Martin
--
http://mail.python.org/mailma
"John Machin" schrieb
>
> [analysis of super() "oddness"]
>
A great analysis, but what's a "pogo stick" and where
can I get one?
Thanks
Martin
--
http://mail.python.org/mailman/listinfo/python-list
"Russell E. Owen" schrieb
>
> >I have a number-crunching application that spits out
> >a lot of numbers. Now I'd like to pipe this into a
> >python app and plot them using Tkinter, such as:
> >$ number_cruncher | myplot.py
> >But with Tkinter once I call Tkinter's mainloop() I
> >give up my contro
I have a number-crunching application that spits out
a lot of numbers. Now I'd like to pipe this into a python
app and plot them using Tkinter, such as:
$ number_cruncher | myplot.py
But with Tkinter once I call Tkinter's mainloop() I
give up my control of the app and I can't continue to
read in
41 matches
Mail list logo