Re: multiple pattern regular expression

2008-04-26 Thread Chris Henry
On Apr 25, 8:37 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
 micron_make [EMAIL PROTECTED] writes:
  I am trying to parse a file whose contents are :

  parameter=current
  max=5A
  min=2A
[snip]
 If every line of the file is of the form name=value, then regexps are
 indeed not needed.  You could do something like that.

 params = {}
 for line in file:
     name, value = line.strip().split('=', 2)
     params[name] = value

 (untested)
 Then params should be the dictionary you want.

I'm also interested in this problem. While this solution works, I'm
looking for solution that will also check whether the parameter name/
value is of a certain pattern (these patterns may be different, e.g.
paramA, paramB, paramC may take integers value, while paramD may take
true/false). Is there a way to do this easily?

I'm new to Python and the solution I can think off involve a loop over
a switch (a dictionary with name-function mapping). Is there other,
more elegant solution?

Chris
--
http://mail.python.org/mailman/listinfo/python-list


So you think PythonCard is old? Here's new wine in an old bottle.

2008-04-26 Thread John Henry
For serveral years, I have been looking for a way to migrate away from
desktop GUI/client-server programming onto the browser based network
computing model of programming.  Unfortunately, up until recently,
browser based programs are very limited - due to the limitation of
HTML itself.  Eventhough PythonCard hasn't keep up with the latest
widgets in wxpython, the programs so created still works a lot better
- until now.

If you look at programs at some of the major sites these days - like
Google calendar, Netflix, blockbuster, and so forth - you would
undoubtedly notice that the quality of the programs are pretty much at
par with the desktop programs we use everyday.  Since the curious mind
wanted to know how these programs are done, I started investigating
and found out that what a difference a few years have made to
Javascript - the once much hated beast of the Internet age - and
during my search for perfection, I found Qooxdoo (http://
qooxdoo.org/).

Qooxdoo is a Javascript toolkit that sits on top of Ajax.  Take a look
at some of the *impressive* widgets
at http://demo.qooxdoo.org/current/showcase/#Form.

So, what's that got to do with Pythoncard?  Read on.

After trying for a few days learning Qooxdoo, my head really really
hurts.  Getting too old to learn this stuff, I was mumbling.

Then I looked some more.  I found QxTransformer (http://
sites.google.com/a/qxtransformer.org/qxtransformer/Home) which is a
XSLT toolkit that creats XML code that invoke qooxdoo.

So, what's that got to do with Pythoncard?  Read on.

After trying for a few days learning QxTransformer, my head really
really hurts.  Getting too old to learn
this stuff, I was mumbling.

I want Pythoncard.

Damn Pythoncard!  Once you got hooked, everything else looks
impossibly complicated and unproductive.

But then I looked closer.  It turns out the XML file created by
QxTransformer is *very* similar in structure when compared to the
resource files used in PythonCard.  Since there are no GUI builders
for QxTransformer, and I can't affort to buy the one for Qooxdoo
(Java!  Yuk!), I decided to roll up my sleeves, took the Pythoncard's
Layout Manager and modified it and created my own Poor Man's Qooxdoo
GUI Layout Designer.

The result?  See the partially completed application at:

http://test.powersystemadvisors.com/

and the same application running from the desktop:

http://test.powersystemadvisors.com/desktopHelloWorld.jpg

It shouldn't be long before I can fill in the gaps and have the GUI
builder maps the rest of the Pythoncard widgets to Qooxdoo widgets.
Once I've done that, I can have the same application running from the
desktop, or from the browser.  And it shouldn't take more than minutes
to create such applications.

Welcome to the modernized world of Pythoncard!!!
--
http://mail.python.org/mailman/listinfo/python-list


new user

2008-04-26 Thread [EMAIL PROTECTED]
Hi ! This is my first message .

I new here . I like python , blender 3d and opengl and is a hobby for
me.
I have a site www.catalinfest.xhost.ro where i write about me and
python , blender ...
I hope learning more on this group .

Have a nice day !


--
http://mail.python.org/mailman/listinfo/python-list


Re: multiple pattern regular expression

2008-04-26 Thread Arnaud Delobelle
Chris Henry [EMAIL PROTECTED] writes:

 On Apr 25, 8:37 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
 micron_make [EMAIL PROTECTED] writes:
  I am trying to parse a file whose contents are :

  parameter=current
  max=5A
  min=2A
 [snip]
 If every line of the file is of the form name=value, then regexps are
 indeed not needed.  You could do something like that.

 params = {}
 for line in file:
     name, value = line.strip().split('=', 2)
 ^ 1, obviously!
     params[name] = value

 (untested)
 Then params should be the dictionary you want.

 I'm also interested in this problem. While this solution works, I'm
 looking for solution that will also check whether the parameter name/
 value is of a certain pattern (these patterns may be different, e.g.
 paramA, paramB, paramC may take integers value, while paramD may take
 true/false). Is there a way to do this easily?

 I'm new to Python and the solution I can think off involve a loop over
 a switch (a dictionary with name-function mapping). Is there other,
 more elegant solution?

Sounds good to me.

E.g.

def boolean(x):
if x == 'true':
return True
elif x == 'false'
return False
else:
raise ValueError(Invalid boolean: '%s' % x)

paramtypes = { 'paramA': int, ..., 'paramD': boolean }

#Then

for line in file:
line = line.strip()
if not line: continue
name, value = line.split('=', 1)
if name in paramtypes:
try:
value = paramtypes[name](value)
except ValueError, e:
# handle the error
value = e
else:
# What to do for untyped parameters
pass
params[name] = value

-- 
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list


Re: function that accepts any amount of arguments?

2008-04-26 Thread Lie
On Apr 25, 2:12 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 On 24 avr, 14:28, malkarouri [EMAIL PROTECTED] wrote:

  On Apr 24, 12:43 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote:

  [...]

   Not quite sure what's the best thing to do in the second case - raise a
   ValueError if args is empty, or silently return 0.0 - but I'd tend to
   choose the first solution (Python's Zen, verses 9-11).

  What's wrong with raising ZeroDivisionError (not stopping the
  exception in the first place)?

 Because - from a semantic POV -  the real error is not that you're
 trying to divide zero by zero, but that you failed to pass any
 argument. FWIW, I'd personnaly write avg as taking a sequence - ie,
 not using varargs - in which case calling it without arguments would a
 TypeError (so BTW please s/Value/Type/ in my previous post).

The problem with passing it as a sequence is, if you want to call it,
you may have to wrestle with this odd looking code:
avg((3, 4, 6, 7))

rather than this, more natural code:
avg(3, 4, 6, 7)

And FWIW, the OP asked if it is possible to pass variable amount of
arguments, avg is just a mere example of one where it could be used
not where it could be best used.

Nick Craig-Wood wrote:
 Steve Holden [EMAIL PROTECTED] wrote:
  Ken wrote:
 Steve Holden [EMAIL PROTECTED] wrote in message
  [...]
 def mean(*x):
 total = 0.0
 for v in x:
 total += v
 return v/len(x)

  think you want total/len(x) in return statement

  Yes indeed, how glad I am I wrote untested. I clearly wasn't pair
  programming when I wrote this post ;-)

 Posting to comp.lang.python is pair programming with the entire
 internet ;-)

No, actually it's pair programming with the readers of c.l.py (or more
accurately with the readers of c.l.py that happens to pass the said
thread).
--
http://mail.python.org/mailman/listinfo/python-list


problem with listdir

2008-04-26 Thread jimgardener
hi
i have a directory containing .pgm files of P5 type.i wanted to read
the pixel values of these files ,so as a firststep i wrote code to
make a  list  of filenames using listdir

pgmdir=f:\code\python\pgmgallery # where i have pgm files
g2=listdir(pgmdir)

i get the following error
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'f:\\code\\python\pgmgallery/*.*'

i am running python on winXP ..can anyone tell me why i get this
error?
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with listdir

2008-04-26 Thread David

  i get the following error
  WindowsError: [Error 123] The filename, directory name, or volume
  label syntax is incorrect: 'f:\\code\\python\pgmgallery/*.*'

  i am running python on winXP ..can anyone tell me why i get this
  error?
  --

From some Googling, it looks like this error can happen in Windows
when you have registry problems. This isn't a Python problem as far as
I can tell.

A few things for you to try:

* Try running your code on another machine with the same directory.

* Run cmd.exe and see if you can run dir f:\\code\\python\pgmgallery/*.*

* Try using other drives besides F: (C: is a good start)

* Try using other directories under F: drive in your program and see
when you start hitting the problem.

David.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Desktop notifications on Windows

2008-04-26 Thread David
On Sat, Apr 26, 2008 at 4:41 AM,  [EMAIL PROTECTED] wrote:
 I'm looking for a way to implement desktop notifications (much like an
  instant messaging program or a mail notifier) within my Python
  application, on Windows only (no Gtk/Galago, please). I need no more
  than a simple text-based notification, which should be clickable and
  have a timeout, nothing else. I do not want to use Windows's balloon
  tips, either. Any suggestions?
  --

You could use Tkinter, which comes with Python.
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with listdir

2008-04-26 Thread Francesco Bochicchio
On Sat, 26 Apr 2008 01:24:23 -0700, jimgardener wrote:

 hi
 i have a directory containing .pgm files of P5 type.i wanted to read
 the pixel values of these files ,so as a firststep i wrote code to
 make a  list  of filenames using listdir
 
 pgmdir=f:\code\python\pgmgallery # where i have pgm files
 g2=listdir(pgmdir)
 
 i get the following error
 WindowsError: [Error 123] The filename, directory name, or volume
 label syntax is incorrect: 'f:\\code\\python\pgmgallery/*.*'
 
 i am running python on winXP ..can anyone tell me why i get this
 error?

Did you try using a raw string as pathname
pgmdir=rf:\code\python\pgmgallery 
?

AFAIK, the character '\' in interpreted in Python as the beginning of
an escape sequence (such as '\n') and it should be doubled ( as in the 
error message) or a raw string should be used, telling Python that there
are no escape sequences inside. 
However, from the message it looks like the path as been understood as
such, so this might not be the case. 

Ciao
-
FB
--
http://mail.python.org/mailman/listinfo/python-list


Re: display monochromatic images wxPython

2008-04-26 Thread Francesco Bochicchio
On Fri, 25 Apr 2008 14:42:17 -0700, [EMAIL PROTECTED] wrote:

 Dear All,
 I want to write a GUI program with wxPython displaying an image. But
 the image I have is monochromatic. When I retrieve the data from the
 image I end up with a list of integer. Starting from a list of integer
 and knowing the width and height of the image, how do I display such
 an image on a wx panel or frame ? I have had a look at the wxPython
 demo but there I see only images where the data is a list of tuple
 consisting of r,g ,b values. Is there are function where I directly
 can input the list of array and let it display the image ?
 Thanks in advance
 
 RR

I think that RGB colors with the same amount of R,G, and B levels always
result in some shade of gray. If so, you could try building your image
data by convering each numver in a triplet of equal numbers.

Ciao

FB
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with listdir

2008-04-26 Thread Kam-Hung Soh
On Sat, 26 Apr 2008 19:07:45 +1000, Francesco Bochicchio  
[EMAIL PROTECTED] wrote:



On Sat, 26 Apr 2008 01:24:23 -0700, jimgardener wrote:


hi
i have a directory containing .pgm files of P5 type.i wanted to read
the pixel values of these files ,so as a firststep i wrote code to
make a  list  of filenames using listdir

pgmdir=f:\code\python\pgmgallery # where i have pgm files
g2=listdir(pgmdir)

i get the following error
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'f:\\code\\python\pgmgallery/*.*'

i am running python on winXP ..can anyone tell me why i get this
error?


Did you try using a raw string as pathname
pgmdir=rf:\code\python\pgmgallery
?

AFAIK, the character '\' in interpreted in Python as the beginning of
an escape sequence (such as '\n') and it should be doubled ( as in the
error message) or a raw string should be used, telling Python that there
are no escape sequences inside.
However, from the message it looks like the path as been understood as
such, so this might not be the case.

Ciao
-
FB


Neither \c nor \p are escape characters in Section 2.4.1 String literals.

Could there be some files in that directory whose name is not a valid  
Windows file name?  Windows file names cannot have the following symbols:


\ / : * ?|

--
Kam-Hung Soh a href=http://kamhungsoh.com/blog;Software Salariman/a
--
http://mail.python.org/mailman/listinfo/python-list


Re: nntplib retrieve news://FULL_URL

2008-04-26 Thread David
 So I have established a connection to an nntp server and I am
  retrieving articles to other articles on the server such as
  news://newsclip.ap.org/[EMAIL PROTECTED]

  Now I am wondering how I query for that article based off of the url?

  I assume D8L4MFAG0 is an id of some sort but when I try and retrieve
  that article via myNntpObject.article('D8L4MFAG0') I get an error of
  423 Bad article number. Which makes sense as all the other article
  numbers are integers.

  D8L4MFAG0 actually looks like a doc-id value for an NITF article
  stored on the NNTP server which I am retrieving content off of.

  Anyone have any ideas on how I fetch this content?

Have a look at the 'Message-ID' header of articles on the server. They
usually start and end with  and end with .

An example from comp.lang.python:

[EMAIL PROTECTED]

You probably got the 423 Bad article number error because there
wasn't a  and  in your message ID, so it tried to parse it as an
article number instead.

I couldn't check your example because newsclip.ap.org requires a login.

David.
--
http://mail.python.org/mailman/listinfo/python-list


Re: display monochromatic images wxPython

2008-04-26 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote:

 I want to write a GUI program with wxPython displaying an image.

Then be sure to check out the wxPython demo application. It displays
lots of images.

Regards,


Björn

-- 
BOFH excuse #217:

The MGs ran out of gas.

--
http://mail.python.org/mailman/listinfo/python-list


ioctl.py

2008-04-26 Thread Neal Becker
Gabriel Genellina wrote:

 En Fri, 25 Apr 2008 09:30:56 -0300, Neal Becker [EMAIL PROTECTED]
 escribió:
 
 I need an ioctl call equivalent to this C code:

 my_struct s;
 s.p = p;  a pointer to an array of char
 s.image_size = image_size;
 return (ioctl(fd, xxx, s));

 I'm thinking to use python array for the array of char, but I don't see
 how
 to put it's address into the structure.
 
 Use the array's buffer_info() method:
 buffer_info(): Return a tuple (address, length) giving the current
 memory address and the length in elements of the buffer used to hold
 array's contents.
 http://docs.python.org/lib/module-array.html
 and you can use the struct module to build my_struct.
 
 Maybe ctypes is the answer?
 
 It could be used too, but I think that in this case it's harder to use
 ctypes.
 
Here is what ioctl should be:

from ctypes import *

libc = CDLL ('/lib/libc.so.6')
#print libc.ioctl

libc.ioctl.argtypes = (c_int, c_int, POINTER (eos_dl_args_t))

_IOC_WRITE = 0x1

_IOC_NRBITS=8
_IOC_TYPEBITS=  8
_IOC_SIZEBITS=  14
_IOC_DIRBITS=   2

_IOC_NRSHIFT=   0
_IOC_TYPESHIFT= (_IOC_NRSHIFT+_IOC_NRBITS)
_IOC_SIZESHIFT= (_IOC_TYPESHIFT+_IOC_TYPEBITS)
_IOC_DIRSHIFT=  (_IOC_SIZESHIFT+_IOC_SIZEBITS)


def _IOC (dir, type, nr, size):
return (((dir)   _IOC_DIRSHIFT) | \
 ((type)  _IOC_TYPESHIFT) | \
 ((nr)_IOC_NRSHIFT) | \
 ((size)  _IOC_SIZESHIFT))

def ioctl (fd, request, args):
return libc.ioctl (fd, request, args)


--
http://mail.python.org/mailman/listinfo/python-list

Re: Pyserial - send and receive characters through linux serial port

2008-04-26 Thread Bjoern Schliessmann
terry wrote:

 I am trying to send a character to '/dev/ttyS0' and expect the
 same character and upon receipt I want to send another character.
 I tired with Pyserial but in vain.

Pyserial works very well for me (despite the device I connect to has
quite a screwed protocol and implementation).

 Test Set up:
 
 1. Send '%' to serial port and make sure it reached the serial
 port. 2. Once confirmed, send another character.
 
 I tried with write and read methods in Pyserial but no luck.

Are you actaully trying to get lucky by doing this, or are you
observing a specific problem, e.g. nothing is received or wrong
characters are received? Also, by what are they received?

Regards,


Björn

-- 
BOFH excuse #139:

UBNC (user brain not connected)

--
http://mail.python.org/mailman/listinfo/python-list


gothic 3 patch

2008-04-26 Thread leoniaumybragg
gothic 3 patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


dark crusade patch

2008-04-26 Thread leoniaumybragg
dark crusade patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


cotton patch cafe

2008-04-26 Thread leoniaumybragg
cotton patch cafe

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


sims 2 patch

2008-04-26 Thread leoniaumybragg
sims 2 patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


clonedvd crack

2008-04-26 Thread leoniaumybragg
clonedvd crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


investronica crack

2008-04-26 Thread leoniaumybragg
investronica crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


crack addict behavior

2008-04-26 Thread leoniaumybragg
crack addict behavior

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


windows xp sp2 activation crack

2008-04-26 Thread leoniaumybragg
windows xp sp2 activation crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


exelon patch

2008-04-26 Thread leoniaumybragg
exelon patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


spynomore crack

2008-04-26 Thread leoniaumybragg
spynomore crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


civilization 3 crack

2008-04-26 Thread leoniaumybragg
civilization 3 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


shredder 2 3 serial crack

2008-04-26 Thread leoniaumybragg
shredder 2 3 serial crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


neupro patch

2008-04-26 Thread leoniaumybragg
neupro patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


limewire crack

2008-04-26 Thread leoniaumybragg
limewire crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


b-jigsaw serial crack keygen

2008-04-26 Thread leoniaumybragg
b-jigsaw serial crack keygen

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Riva FLV Encoder 2.0 - FLV Converter

2008-04-26 Thread king . aftab
This robust video converter ably packs a number of file formats into
the Flash video format and is stylish to boot. Riva FLV Encoder works
well with the usual suspects: AVI, WMV, MPEG, and MOV files.
Riva is a great freeware application for a reliable (and inexpensive)
way to convert video files to the Web. Download from here:
http://freeware4.blogspot.com/2008/04/riva-flv-encoder-20-flv-converter.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: nntplib retrieve news://FULL_URL

2008-04-26 Thread Nemesis
[EMAIL PROTECTED] wrote:

 So I have established a connection to an nntp server and I am
 retrieving articles to other articles on the server such as
 news://newsclip.ap.org/[EMAIL PROTECTED]

 Now I am wondering how I query for that article based off of the url?

 I assume D8L4MFAG0 is an id of some sort but when I try and retrieve
 that article via myNntpObject.article('D8L4MFAG0') I get an error of
 423 Bad article number. Which makes sense as all the other article
 numbers are integers.

You should study a little bit NNTP RFCs ;-)
Anyway [EMAIL PROTECTED] could be the Message-ID of the article, a 'unique'
identifier associated to each article, while the Article Number is unique on
the server (but it changes on different servers).

the nntplib NNTP.article command can accept either Message-ID or Number as
argument, but if you want to use Message-ID you need to enclose it in brackets 
. 

So in your case this query should work:

myNntpObject.article('[EMAIL PROTECTED]')

Regards.
-- 
Love is an irresistible desire to be irresistibly desired.
 _  _  _
| \| |___ _ __  ___ __(_)___
| .` / -_) '  \/ -_|_- (_-
|_|\_\___|_|_|_\___/__/_/__/ http://xpn.altervista.org

--
http://mail.python.org/mailman/listinfo/python-list


API's and hardware communication. Newbie

2008-04-26 Thread Grayham
Hi all

I am new to this group so 'Hello All'

I have a PC which is running linux and in it have installed a digital
satellite card. I would like to write some software to access the card,
tune it and bring back video. Basically a home brew DVB-s application.

Being a non/new programmer (apart from some basic too many years ago) I
decided to teach my self Python as from what i have read it's an easy and
powerfull language to learn. I have been at it a few weeks and am getting
on OK and finding it reasonably OK to pick up.

The problem is i can find little to no information on programming for DVB
cards or on how to access the Linux tv API in Python but I can find lots of
information in C. This is making me think should i bother with Python and
just learn C even though this will probably take a lot longer.

Can some one help me or point me at a resource somewhere or would it be best
to just learn C instead.  

I am aware this is a complicated little project for someone just starting
out but it will be a multifaceted program with loads of interesting
classes, functions and loops and i don't have to start with the really
difficult stuff first. I just want to know if it's possible under python to
access the DVB card and if so how?

Cheers
Grayham 
--
http://mail.python.org/mailman/listinfo/python-list


Re: Logging ancestors ignored if config changes?

2008-04-26 Thread andrew cooke
One way to handle this is to make creation of module-level Loggers
lazy, and make sure that logging initialisation occurs before any
other logging is actually used (which is not so hard - just init log
at the start of the application).

Of course, there's a performance hit...

For example:

class Log(object):
def __init__(self, name):
super(Log, self).__init__()
self._name = name
self._lazy = None
def __getattr__(self, key):
if not self._lazy:
self._lazy = logging.getLogger(self._name)
return getattr(self._lazy, key)

and then, in some module:

from acooke.util.log import Log
log = Log(__name__)
[...]
class Foo(object):
def my_method(self):
log.debug(this works as expected)

Andrew
--
http://mail.python.org/mailman/listinfo/python-list


Re: Receive data from socket stream

2008-04-26 Thread Irmen de Jong

[EMAIL PROTECTED] wrote:

Until now, I've been
doing this little trick:

data = client.recv(256)
new = data
while len(new) == 256:
new = client.recv(256)
data += new


Are you aware that recv() will not always return the amount of bytes asked for?
(send() is similar; it doesn't guarantee that the full buffer you pass to it will be 
sent at once)


I suggest reading this: http://www.amk.ca/python/howto/sockets/sockets.html


--irmen
--
http://mail.python.org/mailman/listinfo/python-list


Re: Loading associated files

2008-04-26 Thread flarefight
I can't get this to work (I am on XP SP2 by the way and using Python
2.5),

I wrote a very simple script to test the idea:

import sys

for arg in sys.argv:
print arg

raw_input(Done) #Merely to slow the program down so i can see output

and then setup a file extension .xyz, placed it in the registry, can
get a .xyz file to work as a python script so the registry setup is
fine, but when i try and put the parameter to the above program and a
%1 (or even without) it gets the following error message from windows:

C:\...\hmm.xyz is not a valid Win32 application.

any suggestions??
--
http://mail.python.org/mailman/listinfo/python-list


password crack

2008-04-26 Thread carlwuhwdmckay
password crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


fentanyl patch

2008-04-26 Thread carlwuhwdmckay
fentanyl patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


windows xp crack

2008-04-26 Thread carlwuhwdmckay
windows xp crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


diet patch

2008-04-26 Thread carlwuhwdmckay
diet patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


cod4 multiplayer crack

2008-04-26 Thread carlwuhwdmckay
cod4 multiplayer crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


cabbage patch dolls

2008-04-26 Thread carlwuhwdmckay
cabbage patch dolls

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


call of duty 4 crack multiplayer

2008-04-26 Thread carlwuhwdmckay
call of duty 4 crack multiplayer

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


serials and cracks

2008-04-26 Thread carlwuhwdmckay
serials and cracks

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


keygen fifa 08

2008-04-26 Thread carlwuhwdmckay
keygen fifa 08

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


garmin keygen

2008-04-26 Thread carlwuhwdmckay
garmin keygen

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


perfect patch

2008-04-26 Thread carlwuhwdmckay
perfect patch

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


num-lock serial crack keygen

2008-04-26 Thread carlwuhwdmckay
num-lock serial crack keygen

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


cracks full downloads

2008-04-26 Thread marli305nugent
cracks full downloads

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


area council patch news

2008-04-26 Thread marli305nugent
area council patch news

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


windows xp crack serial

2008-04-26 Thread marli305nugent
windows xp crack serial

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


serial numbers crack

2008-04-26 Thread carlwuhwdmckay
serial numbers crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


norton internet security 2006 crack

2008-04-26 Thread marli305nugent
norton internet security 2006 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


chessgenius 1.6 crack

2008-04-26 Thread marli305nugent
chessgenius 1.6 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


crack cocaine pictures

2008-04-26 Thread marli305nugent
crack cocaine pictures

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


xp password crack

2008-04-26 Thread marli305nugent
xp password crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


red alert 2 cd crack

2008-04-26 Thread marli305nugent
red alert 2 cd crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Re: Logging ancestors ignored if config changes?

2008-04-26 Thread Vinay Sajip
On 26 Apr, 04:02, andrew cooke [EMAIL PROTECTED] wrote:
 Hi,

 I am seeing some odd behaviour withloggingwhich would be explained
 if loggers that are not defined explicitly (but which are controlled
 via their ancestors) must be created after theloggingsystem is
 configured via fileConfig().

 That's a bit abstract, so here's the problem itself:  I define my log
 within a module by doing

 importlogging
 log =logging.getLogger(__name__)

 Now typically __name__ will be something like acooke.utils.foo.

 That happens before the application configureslogging, which it does
 by callinglogging.config.fileConfig() to load a configuration.

 If I do that, then I don't see anyloggingoutput from
 acooke.utils.foo (when using log from above after fileConfig has
 been called) unless I explicitly define a logger with that name.
 Neither root nor an acooke logger, defined in the config file, are
 called.

 Is this a bug?  Am I doing something stupid?  To me the above seems
 like a natural way of using the system...

 Thanks,
 Andrew

It's not a bug, it's by design (for better or worse). A call to
fileConfig disables all existing loggers which are not explicitly
named in the new configuration. Configuration is intended for one-off
use rather than in an incremental mode.

Better approaches would be to defer creation of the loggers
programmatically until after the configuration call, or else to name
them explicitly in the configuration.

Regards,

Vinay Sajip
--
http://mail.python.org/mailman/listinfo/python-list


Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
Both codes below read the same huge(~35MB) text file.
In the file  100 lines, the length of each line  99 chars.

Stable result:
Python runs ~0.65s
C : ~0.70s

Any thoughts?


import time
t=time.time()
f=open('D:\\some.txt','r')
z=f.readlines()
f.close()
print len(z)
print time.time()-t
m=input()
print z[m]


#include cstdio
#include cstdlib
#include iostream
#include ctime

using namespace std;
char vs[1002000][99];
FILE *fp=fopen(D:\\some.txt,r);

int main() {
int i=0;
while (true) {
if (!fgets(vs[i],999,fp)) break;
++i;
}
fclose(fp);
cout  i  endl;
cout  clock()/CLOCKS_PER_SEC  endl;

int m;
cin  m;
cout  vs[m];
system(pause);
return 0;
}
--
http://mail.python.org/mailman/listinfo/python-list


Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread animalMutha


Hrvoje Niksic wrote:
 Hrvoje Niksic [EMAIL PROTECTED] writes:

  Joshua Kugler [EMAIL PROTECTED] writes:
 
  self.me = []
  self.me = {}
 
  Use object.__setattr__(self, 'me') = [] and likewise for {}.

 Oops, that should of course be object.__setattr__(self, 'me', []).
--
http://mail.python.org/mailman/listinfo/python-list


Re: Pyserial - send and receive characters through linux serial port

2008-04-26 Thread Grant Edwards
On 2008-04-25, terry [EMAIL PROTECTED] wrote:

 I am trying to send a character to '/dev/ttyS0' and expect the
 same character and upon receipt I want to send another
 character. I tired with Pyserial but in vain.

Pyserial works.  I've been using it almost daily for many
years.  Either your program is broken, your serial port is
broken, or the device connected to the serial port is broken.

 Test Set up:

 1. Send '%' to serial port and make sure it reached the serial port.
 2. Once confirmed, send another character.

 I tried with write and read methods in Pyserial but no luck.

 Can you help?

Ah yes, the problem is in line 89 of your program.

 

We've no way to help if you don't provide details. If you
really want help, write as small a program as possible that
exhibits the problem.  I'd like to emphasize _small_. The
larger the program the less likely people are to look at it,
and the less likely they are to find the problem if they do
look at it.

Much of the time the exercise of writing a small demo program
will lead you to the answer.  If not, then post it, along with
the output from the program that shows the problem.

Then we can tell you what you did wrong.

-- 
Grant Edwards   grante Yow! I'm also against
  at   BODY-SURFING!!
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread animalMutha
 Consider reading the *second* paragraph about __setattr__ in section
 3.4.2 of the Python Reference Manual.

if you are simply going to answer rtfm - might as well kept it to
yourself.
--
http://mail.python.org/mailman/listinfo/python-list


Spy Emergency 2007 crack

2008-04-26 Thread fr5478bey
Spy Emergency 2007 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


registry mechanic 7.0 crack

2008-04-26 Thread fr5478bey
registry mechanic 7.0 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Treasures Of Montezuma crack

2008-04-26 Thread fr5478bey
Treasures Of Montezuma crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


RegistryBooster2 crack

2008-04-26 Thread fr5478bey
RegistryBooster2 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


tiberium wars crack

2008-04-26 Thread fr5478bey
tiberium wars crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Capture NX 1.2 crack

2008-04-26 Thread fr5478bey
Capture NX 1.2 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


inventor12 crack

2008-04-26 Thread fr5478bey
inventor12 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


doom 3 crack

2008-04-26 Thread fr5478bey
doom 3 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


nod crack

2008-04-26 Thread fr5478bey
nod crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


photoshop cs crack

2008-04-26 Thread fr5478bey
photoshop cs crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


vegas crack

2008-04-26 Thread fr5478bey
vegas crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


navigon 6 crack

2008-04-26 Thread fr5478bey
navigon 6 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


avg internet security crack

2008-04-26 Thread fr5478bey
avg internet security crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


bookworm adventure crack

2008-04-26 Thread fr5478bey
bookworm adventure crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


big city adventure crack

2008-04-26 Thread fr5478bey
big city adventure crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread Carl Banks
On Apr 26, 11:10 am, n00m [EMAIL PROTECTED] wrote:
 Both codes below read the same huge(~35MB) text file.
 In the file  100 lines, the length of each line  99 chars.

 Stable result:
 Python runs ~0.65s
 C : ~0.70s

 Any thoughts?

Yes.

Most of the dirty work in the Python example is spent in tight loop
written in C.  This is very likely to be faster on Python on Windows
than your C example for several reasons:

1. Python is compiled with Microsoft's C compiler, which produces more
optimal code than Mingw.

2. The Python readline() function has been in the library for a long
time and has had time for many developers to optimize it's
performance.

3. Your pure C code isn't even C, let alone pure C.  It's C++.  On
most systems, the C++ iostream libraries have a lot more overhead than
C's stdio.

And, finally, we must not fail to observe that you measured these
times without startup, which is obviousy much greater for Python.  (Of
course, we only need to point this so it's not misunderstood that
you're claiming this Python process will terminate faster than the C++
one.)


So, I must regrettably opine that your example isn't very meaningful.


 import time
 t=time.time()
 f=open('D:\\some.txt','r')
 z=f.readlines()
 f.close()
 print len(z)
 print time.time()-t
 m=input()
 print z[m]

 #include cstdio
 #include cstdlib
 #include iostream
 #include ctime

 using namespace std;
 char vs[1002000][99];
 FILE *fp=fopen(D:\\some.txt,r);

 int main() {
 int i=0;
 while (true) {
 if (!fgets(vs[i],999,fp)) break;
 ++i;
 }
 fclose(fp);
 cout  i  endl;
 cout  clock()/CLOCKS_PER_SEC  endl;

 int m;
 cin  m;
 cout  vs[m];
 system(pause);
 return 0;

 }

--
http://mail.python.org/mailman/listinfo/python-list


Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread Aahz
In article [EMAIL PROTECTED],
Arnaud Delobelle  [EMAIL PROTECTED] wrote:
Joshua Kugler [EMAIL PROTECTED] writes:

 self.me = []
 for v in obj:
 self.me.append(ObjectProxy(v))

Note that is could be spelt:

self.me = map(ObjectProxy, v)

It could also be spelt:

self.me = [ObjectProxy(v) for v in obj]

which is my preferred spelling
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

Why is this newsgroup different from all other newsgroups?  
--
http://mail.python.org/mailman/listinfo/python-list


Re: So you think PythonCard is old? Here's new wine in an old bottle.

2008-04-26 Thread Aahz
In article [EMAIL PROTECTED],
John Henry  [EMAIL PROTECTED] wrote:

But then I looked closer.  It turns out the XML file created by
QxTransformer is *very* similar in structure when compared to the
resource files used in PythonCard.  Since there are no GUI builders
for QxTransformer, and I can't affort to buy the one for Qooxdoo
(Java!  Yuk!), I decided to roll up my sleeves, took the Pythoncard's
Layout Manager and modified it and created my own Poor Man's Qooxdoo
GUI Layout Designer.

Cute!  When you have working code, please do upload to PyPI.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

Why is this newsgroup different from all other newsgroups?  
--
http://mail.python.org/mailman/listinfo/python-list


Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread Marc 'BlackJack' Rintsch
On Sat, 26 Apr 2008 08:28:38 -0700, animalMutha wrote:

 Consider reading the *second* paragraph about __setattr__ in section
 3.4.2 of the Python Reference Manual.
 
 if you are simply going to answer rtfm - might as well kept it to
 yourself.

Yes, but if you are telling where exactly to find the wanted information
in the documentation, like John did, you are teaching the OP how to fish.
Which is a good thing.  Much more helpful than your remark anyway.  You
might as well have kept it to yourself.  :-þ

Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list

xpand rally crack

2008-04-26 Thread lscbtfws
xpand rally crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Power mp3 cutter crack

2008-04-26 Thread lscbtfws
Power mp3 cutter crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


capture nx crack

2008-04-26 Thread lscbtfws
capture nx crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


empire earth 2 crack

2008-04-26 Thread lscbtfws
empire earth 2 crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


age of empires III crack

2008-04-26 Thread lscbtfws
age of empires III crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


dfx audio enhancer crack

2008-04-26 Thread lscbtfws
dfx audio enhancer crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


get data back crack

2008-04-26 Thread lscbtfws
get data back crack

http://cracks.00bp.com


F
R
E
E


C
R
A
C
K
S
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread n00m
fgets() from C++ iostream library???

I guess if I'd came up with Python reads SLOWER than C
I'd get another (not less) smart explanation why it's so.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread Arnaud Delobelle
[EMAIL PROTECTED] (Aahz) writes:

 In article [EMAIL PROTECTED],
 Arnaud Delobelle  [EMAIL PROTECTED] wrote:
Joshua Kugler [EMAIL PROTECTED] writes:

 self.me = []
 for v in obj:
 self.me.append(ObjectProxy(v))

Note that is could be spelt:

self.me = map(ObjectProxy, v)
 ^-- I meant obj!

 It could also be spelt:

 self.me = [ObjectProxy(v) for v in obj]

 which is my preferred spelling

I was waiting patiently for this reply...  And your preferred spelling
is py3k-proof as well, of course.

I don't write map(lambda x: x+1, L) or map(itemgetter('x'), L) but I
like to use it when the first argument is a named function,
e.g. map(str, list_of_ints).

-- 
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with listdir

2008-04-26 Thread jimgardener

 * Run cmd.exe and see if you can run dir f:\\code\\python\pgmgallery/*.*


that causes a message 'Invalid switch - *.*.'

 * Try using other directories under F: drive in your program and see when 
 you start hitting the problem.

i tried that..on some directories in the same drive  this gives
correct result and returns a list of filenames.however the error
occurs on other directories ,looks like a weird windows problem!
--
http://mail.python.org/mailman/listinfo/python-list


diffing and uniqing directories

2008-04-26 Thread Rustom Mody
Over years Ive collected tgz's of my directories. I would like to diff
and uniq them

Now I guess it would be quite simple to write a script that does a
walk or find through a pair of directory trees, makes a SHA1 of each
file and then sorts out the files whose SHA1s are the same/different.
What is more difficult for me to do is to write a visual/gui tool to
help me do this.

I would guess that someone in the python world must have already done
it [The alternative is to use some of the tools that come with version
control systems like git. But if I knew more about that option I would
not be stuck with tgzs in the first place ;-)]

So if there is such software known please let me know.

PS Also with the spam flood that has hit the python list I dont know
if this mail is being read at all or Ive fallen off the list!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread SL


n00m [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]

import time
t=time.time()
f=open('D:\\some.txt','r')
z=f.readlines()
f.close()
print len(z)
print time.time()-t
m=input()
print z[m]


#include cstdio
#include cstdlib
#include iostream
#include ctime

using namespace std;
char vs[1002000][99];
FILE *fp=fopen(D:\\some.txt,r);

int main() {
   int i=0;
   while (true) {
   if (!fgets(vs[i],999,fp)) break;
   ++i;
   }


first of all I would rewrite the C loop to:

int main() {
   int i=0;
   while (fgets(vs[i],999,fp))
   ++i;
}

but I think that the difference comes from what you do in the beginning of 
the C source:


char vs[1002000][99];

this reserves 99,198,000 bytes so expect a lot of cache trashing in the C 
code!


Is there an implementation of f.readlines on the internet somewhere? 
interested to see in how they implemented it. I'm pretty sure they did it 
smarter than just reserve 100meg of data :)




   fclose(fp);
   cout  i  endl;
   cout  clock()/CLOCKS_PER_SEC  endl;

   int m;
   cin  m;
   cout  vs[m];
   system(pause);
return 0;
} 


--
http://mail.python.org/mailman/listinfo/python-list


Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread SL


SL [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]


n00m [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]

using namespace std;
char vs[1002000][99];



   if (!fgets(vs[i],999,fp)) break;


BTW why are you declaring the array as 99 and pass 999 to fgets to read a 
line?



--
http://mail.python.org/mailman/listinfo/python-list


Re: Calling Python code from inside php

2008-04-26 Thread Diez B. Roggisch

Eric Wertman schrieb:

  A simple yet dangerous and rather rubbish solution (possibly more of a
  hack than a real implementation) could be achieved by using a
  technique described above:
 
  ?php
  echo exec('python foo.py');

 This will spawn a Python interpreter, and not be particularly
 efficient. You could just as well have used CGI.


I'm  in a bit of a similar situation.  I decided to use python to
solve problems where I could, in a more regimented fashion.  For
instance, I have a set of functions in a script, table.py.  After I
set up mod_python to handle requests to a single directory with
python, I can call this with:

?php include(http://localhost/py/table/nodes;); ?

embedded in the page.  This is probably pretty hackish too, but at
least it doesn't spawn a new process, and I don't have to solve things
that aren't related to display with php.


You mean opening a local-loop socket instead of a anonymous socket, 
hogging at least another apache process and then possibly spawning 
another process if the python-script is implemented as real CGI - not 
fast_cgi or python - is the better solution? I doubt that. More wasteful 
in all aspects, with small to any gain at all.


Unix uses pipes as IPC all the time. I fail to see why that is rubbish.

Diez
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread hdante
On Apr 26, 12:10 pm, n00m [EMAIL PROTECTED] wrote:
 Both codes below read the same huge(~35MB) text file.
 In the file  100 lines, the length of each line  99 chars.

 Stable result:
 Python runs ~0.65s
 C : ~0.70s

 Any thoughts?

 import time
 t=time.time()
 f=open('D:\\some.txt','r')
 z=f.readlines()
 f.close()
 print len(z)
 print time.time()-t
 m=input()
 print z[m]

 #include cstdio
 #include cstdlib
 #include iostream
 #include ctime

 using namespace std;
 char vs[1002000][99];
 FILE *fp=fopen(D:\\some.txt,r);

 int main() {
     int i=0;
     while (true) {
         if (!fgets(vs[i],999,fp)) break;
         ++i;
     }
     fclose(fp);
     cout  i  endl;
     cout  clock()/CLOCKS_PER_SEC  endl;

     int m;
     cin  m;
     cout  vs[m];
     system(pause);
 return 0;

 }



 First try again with pure C code and compile with a C compiler, not
with C++ code and C++ compiler.
 Then, tweak the code to use more buffering, to make it more similar
to readline code, like this (not tested):

#include stdio.h
#include time.h

char vs[1002000][100];
char buffer[65536];

int main(void) {
FILE *fp;
int i, m;
clock_t begin, end;
double t;

begin = clock();
fp = fopen(cvspython.txt, r);
i = 0;
setvbuf(fp, buffer, _IOFBF, sizeof(buffer));
while(1) {
if(!fgets(vs[i], 100, fp)) break;
++i;
}
fclose(fp);
printf(%d\n, i);
end = clock();
t = (double)(end - begin)/CLOCKS_PER_SEC;
printf(%g\n, t);

scanf(%d, m);
printf(%s\n, vs[m]);
getchar();
return 0;
}

 Finally, repeat your statement again, if necessary.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread hdante
On Apr 26, 1:15 pm, n00m [EMAIL PROTECTED] wrote:
 fgets() from C++ iostream library???


 fgets is part of the standard C++ library and it lives in the std
namespace.

 I guess if I'd came up with Python reads SLOWER than C
 I'd get another (not less) smart explanation why it's so.
--
http://mail.python.org/mailman/listinfo/python-list


Apologize: annoying dictionary problem, non-existing keys

2008-04-26 Thread bvidinli
Thank you all for your answers. i get many usefull answers and someone
remembered me of avoiding cross-posting.
i apologize from all of you, for cross posting and disturbing.
that day was not a good day for me... it is my fault..

sory and have nice days...

26 Nisan 2008 Cumartesi 02:52 tarihinde Collin Winter [EMAIL PROTECTED] yazdı:
 2008/4/24 bvidinli [EMAIL PROTECTED]:
   I posted to so many lists because,
  
this issue is related to all lists,
this is an idea for python,
this is related to development of python...
  
why are you so much defensive ?
  
i think ideas all important for development of python, software
i am sory anyway hope will be helpful.

  Please consult the documentation first:
  http://docs.python.org/lib/typesmapping.html . You're looking for the
  get() method.

  This attribute of PHP is hardly considered a feature, and is not
  something Python wishes to emulate.

  Collin Winter

2008/4/24, Terry Reedy [EMAIL PROTECTED]:
  
  
Python-dev is for discussion of development of future Python.  Use
  python-list / comp.lang.python / gmane.comp.python.general for usage
  questions.



  ___
  Python-Dev mailing list
  [EMAIL PROTECTED]
  http://mail.python.org/mailman/listinfo/python-dev
  Unsubscribe: 
 http://mail.python.org/mailman/options/python-dev/bvidinli%40gmail.com
  
   
  
  
--
İ.Bahattin Vidinli
Elk-Elektronik Müh.
---
iletisim bilgileri (Tercih sirasina gore):
skype: bvidinli (sesli gorusme icin, www.skype.com)
msn: [EMAIL PROTECTED]
yahoo: bvidinli
  
+90.532.7990607
+90.505.5667711
___
  
  
   Python-Dev mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
 http://mail.python.org/mailman/options/python-dev/collinw%40gmail.com
  




-- 
İ.Bahattin Vidinli
Elk-Elektronik Müh.
---
iletisim bilgileri (Tercih sirasina gore):
skype: bvidinli (sesli gorusme icin, www.skype.com)
msn: [EMAIL PROTECTED]
yahoo: bvidinli

+90.532.7990607
+90.505.5667711
--
http://mail.python.org/mailman/listinfo/python-list


Re: diffing and uniqing directories

2008-04-26 Thread castironpi
On Apr 26, 1:14 pm, Rustom Mody [EMAIL PROTECTED] wrote:
 Over years Ive collected tgz's of my directories. I would like to diff
 and uniq them

 Now I guess it would be quite simple to write a script that does a
 walk or find through a pair of directory trees, makes a SHA1 of each
 file and then sorts out the files whose SHA1s are the same/different.
 What is more difficult for me to do is to write a visual/gui tool to
 help me do this.

 I would guess that someone in the python world must have already done
 it [The alternative is to use some of the tools that come with version
 control systems like git. But if I knew more about that option I would
 not be stuck with tgzs in the first place ;-)]

 So if there is such software known please let me know.

 PS Also with the spam flood that has hit the python list I dont know
 if this mail is being read at all or Ive fallen off the list!

I don't want to give you advice; there is profit in diversity, so
telling you what I use could negatively unify the diverse group.

In another language I know, and I pause to defer to the old and wise
on that, Visual Basic (known to make money), certain counterparts like
Visual Basic for Applications allow construction of scripts in the
owner's other suites.  That is, you can write Basic snippets in Excel,
Access, and so on.  That's one benefit that private ownership leaves,
but not everyone is sold on my country's currency/localcy.  Perhaps
it's in the future of version control systems.  Of course,
standardization of sufficiency to succeed comes from currency too:
success isn't success if it isn't current, per se.

Do you have any interest in contributing your mind or hands to
developing a solid gui framework?  Join a team.
--
http://mail.python.org/mailman/listinfo/python-list


python and web programming, easy way...?

2008-04-26 Thread bvidinli
Hi,

i use currently python for console programming.
in past, i tried it for web programming, to use it instead of php.
Unfortunately, i failed in my attempt to switch to python.
Currently, i make many webbased programs and a Easy Hosting Control
Panel  (www.ehcp.net) that runs on php,
ehcp is a hosting control panel in beta stage..

in fact, i use python, love it and want to switch to it in my all
projects, including webbased programs and ehcp.
Can your recomment me the easiest, most usable way to use python in
web programming..

in past, in my first attemt... i was able to run python as  as apache
cgi, runned it basicly,
but i had many difficulties especially in sessions, cookies...

maybe currently there is a solution, but i dont know.

Please provide me the quickest/most appropriate solution for web
programming in python.
i will try to switch to python in ehcp too..


Currently my web programs are simple Object Oriented programs, that
basicly uses a few files, in php.
i use sessions in use authentications.
i currently use php because it is fairly easy to install/run on apache..
you just put it on server, it runs.. i look something like this for
python. because python programming is much better than php.

Thank you a lot.


-- 
İ.Bahattin Vidinli
Elk-Elektronik Müh.
---
iletisim bilgileri (Tercih sirasina gore):
skype: bvidinli (sesli gorusme icin, www.skype.com)
msn: [EMAIL PROTECTED]
yahoo: bvidinli

+90.532.7990607
+90.505.5667711
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   >