Re: Equivalent of 'wget' for python?

2008-12-11 Thread [EMAIL PROTECTED]
On Dec 11, 2:36 pm, hrishy [EMAIL PROTECTED] wrote:
 Hi

 Please excuse my OOP but is my understanding correct

 urllib.urlretrieve(url_of_zip_file,destination_on_local_filesystem)

 is urllib ---Static Class on which the method urlretrieve method is invoked ?

No urllib is a method. Use type(obj) to find out what python thinks
the type of that object is. Note that object here is not meant in
the same sense as the OOP definition.


 In that case what does the python 3.0 version mean

 import urllib.request
 urllib.request.urlretrieve(url, local_file_name)

 urllib --static class
 request --method
 urlretrieve-- what is this then ?

A 'function'. urllib.request.urlretrieve is the fully qualified name
of the function urlretrieve. In other words urlretrieve lives in the
urllib.request namespace.

-srp


 regards
 Hrishy

 --- On Mon, 8/12/08, Jerry Hill [EMAIL PROTECTED] wrote:

  From: Jerry Hill [EMAIL PROTECTED]
  Subject: Re: Equivalent of 'wget' for python?
  To: [EMAIL PROTECTED]
  Date: Monday, 8 December, 2008, 5:54 PM
  On Mon, Dec 8, 2008 at 11:53 AM, r0g
  [EMAIL PROTECTED] wrote:
   urllib.urlretrieve(url_of_zip_file,
  destination_on_local_filesystem).

  In python 3.0, that appears to be:

  import urllib.request
  urllib.request.urlretrieve(url, local_file_name)

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



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


Re: Equivalent of 'wget' for python?

2008-12-11 Thread [EMAIL PROTECTED]
On Dec 11, 3:36 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 On Dec 11, 2:36 pm, hrishy [EMAIL PROTECTED] wrote:

  Hi

  Please excuse my OOP but is my understanding correct

  urllib.urlretrieve(url_of_zip_file,destination_on_local_filesystem)

  is urllib ---Static Class on which the method urlretrieve method is 
  invoked ?

 No urllib is a method. Use type(obj) to find out what python thinks

typo c/method/module

 the type of that object is. Note that object here is not meant in
 the same sense as the OOP definition.



  In that case what does the python 3.0 version mean

  import urllib.request
  urllib.request.urlretrieve(url, local_file_name)

  urllib --static class
  request --method
  urlretrieve-- what is this then ?

 A 'function'. urllib.request.urlretrieve is the fully qualified name
 of the function urlretrieve. In other words urlretrieve lives in the
 urllib.request namespace.

 -srp



  regards
  Hrishy

  --- On Mon, 8/12/08, Jerry Hill [EMAIL PROTECTED] wrote:

   From: Jerry Hill [EMAIL PROTECTED]
   Subject: Re: Equivalent of 'wget' for python?
   To: [EMAIL PROTECTED]
   Date: Monday, 8 December, 2008, 5:54 PM
   On Mon, Dec 8, 2008 at 11:53 AM, r0g
   [EMAIL PROTECTED] wrote:
urllib.urlretrieve(url_of_zip_file,
   destination_on_local_filesystem).

   In python 3.0, that appears to be:

   import urllib.request
   urllib.request.urlretrieve(url, local_file_name)

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



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


filter iterable based on predicate take from another iterable

2008-12-10 Thread [EMAIL PROTECTED]
Hi,

is there is a neat way to select items from an iterable based on
predicates stored in another iterable without zipping? I can do
something like this:

import itertools
foo = range(10)
# select even numbers
bar = map(lambda i: i%2, foo)
foobarselected = itertools.ifilterfalse(lambda t: t[0], itertools.izip
(bar,foo))
# for simplicity I want to work with the single item list, not the
zipped one
fooselected = list(t[1] for t in foobarselected)

However, it would be nice to have a function combining the last two
instructions. Something like
itertools.ifilterother(bar, foo) - yield iterator with items from foo
where bar is true

Thanks! Bernhard
--
http://mail.python.org/mailman/listinfo/python-list


Determining whether a variable is less/greater than a range.

2008-12-08 Thread [EMAIL PROTECTED]
Hi. I'm having another go at learning Python so I'll probably be
asking a few basic questions. Here is the first one.

a = list(range(10, 21)

b = 9

c = 21

How can I find out if b and c have values less or more than the values
in list a?

Thanks.


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


Re: Determining whether a variable is less/greater than a range.

2008-12-08 Thread [EMAIL PROTECTED]
On Dec 8, 11:12 am, Tim Chase [EMAIL PROTECTED] wrote:
  a = list(range(10, 21))

  b = 9

  c = 21

  How can I find out if b and c have values less or more than the values
  in list a?

 Sounds like a good use for 2.5's addition of the any() and all()
 functions -- you don't mention whether you want your variable
 compared against *any* of the list items or *all* of the list
 items.  You also don't mention whether you want the comparison
 results, or just a single scalar.  Lastly, you omit the details
 of what happens if your target value (d below) falls within the
 range.  One of the following should do it for you:

     a = range(10,21)
     b = 9
     c = 21
     d = 15
     any(b  x for x in a)
    True
     all(b  x for x in a)
    True
     any(c  x for x in a)
    False
     any(d  x for x in a)
    True
     all(d  x for x in a)
    False
     any(c  x for x in a)
    True
     all(c  x for x in a)
    True
     any(d  x for x in a)
    True
     all(d  x for x in a)
    False

 If you just want the comparisons:

    y1 = [bx for x in a]
    y2 = [cx for x in a]
    y3 = [dx for x in a]
    z1 = [(bx, bx) for x in a]
    z2 = [(cx, cx) for x in a]
    z3 = [(dx, dx) for x in a]

 -tkc

Hi Tim. I'm just learning Python at the moment. All I was really
wanting was a True or False value which min and max give.

a = list(range(10, 21))

b = 9

c = 21

if b  min(a)
if c  max(a)

The any() and all() functions look useful so thanks for the tips.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Determining whether a variable is less/greater than a range.

2008-12-08 Thread [EMAIL PROTECTED]
Wow. Thanks Eric and Peter. Very helpful indeed.

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


Re: Determining whether a variable is less/greater than a range.

2008-12-08 Thread [EMAIL PROTECTED]
Found it. min and max functions. I thought that this would be
implemented as a list method:

a.min
a.max

I can see that the built in functions make sense.

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


Symposium “Computational Methods in Image Analysis ” within the USNCCM X Congress – Announce Call for Pap ers

2008-12-08 Thread [EMAIL PROTECTED]
---

(Apologies for cross-posting)

Symposium on “Computational methods in image analysis”
10th US National Congress on Computational Mechanics (USNCCM X)
Columbus, Ohio, USA, July 16-19, 2009
http://usnccm-10.eng.ohio-state.edu/

We would appreciate if you could distribute this information by your
colleagues and co-workers.

---

Dear Colleague,

Within the 10th US National Congress on Computational Mechanics
(USNCCM X), to be held in Ohio, USA, in July 16-19, 2009, we are
organizing the Symposium “Computational methods in image analysis”.
Examples of some topics that will be considered in the symposium
“Computational methods in image analysis” are: Image Analysis, Objects
Modeling, Image Segmentation, Matching, Shape Reconstruction, Motion
and Deformation Analysis, Objects Description and Registration,
Medical imaging, Software Development for Image Analysis and Grid and
High Performance Computing in Image Analysis.
Due to your research activities in those fields, we would like to
invite you to submit your work and participate in the Symposium
“Computational methods in image analysis”.

For instructions and submission, please access to the conference
website at:
http://usnccm-10.eng.ohio-state.edu/abstractsub.html

Please note that, when submitting your work you should select the
Symposium “2.18.4 Computational methods in image analysis”.

Important dates:

- January 31, 2009: Deadline for abstract submission;
- March 1, 2009: Deadline and notification of abstract acceptance;
- July 16-19, 2009: Congress Events.

Kind regards,

João Manuel R. S. Tavares (University of Porto, Portugal,
[EMAIL PROTECTED])
Renato Natal Jorge (University of Porto, Portugal, [EMAIL PROTECTED])
Yongjie Zhang (Carnegie Mellon University, USA,
[EMAIL PROTECTED])
Dinggang Shen (UNC-CH School of Medicine, USA, [EMAIL PROTECTED])
(Symposium organizers)
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to get a beep, OS independent ?

2008-12-07 Thread [EMAIL PROTECTED]
On Dec 7, 8:34 pm, Joe Strout [EMAIL PROTECTED] wrote:
 On Dec 7, 2008, at 4:43 PM, Steven D'Aprano wrote:

  Of course, if you're volunteering to write such a standard system beep
  for Python, I for one would be grateful.

 I am.  But where should I put it?  Assuming we don't want to wait for  
 the (understandably) lengthy and contentious process required to add  
 something to the Python system libraries, where would be the next best  
 place for this sort of simple OS abstraction layer?

 Thanks,
 - Joe

Host it on your web site and send an announcement to
comp.lang.python.announce
 If you don't have a web site (I don't) you might try 
http://pypi.python.org/pypi.
See the tutorial there for instructions. If the setup.py requirement
is too difficult ask for help here.
--
http://mail.python.org/mailman/listinfo/python-list


Ideal girl dance WEBCAM ! Ideal boobs !

2008-12-02 Thread [EMAIL PROTECTED]
http://yeba.pl/show/movies/5257/Perfect_babe_-_Idealna_kobieta
--
http://mail.python.org/mailman/listinfo/python-list


Obtaining SMTP address of a sender and receiver of an outlook mail

2008-12-02 Thread [EMAIL PROTECTED]
Hi all,
   I am trying to use python for extracting contents of an outlook
email. For extracting the list of Recipients addresses I tried using
the MAPI.message.Recipients.Address property, but the problem I am
facing is that it is giving the complete DN name which is putting me
in further complications. Is there any way to obtain the actual SMTP
mail address ([EMAIL PROTECTED]) from the above object? I searched
for it in the MSDN help but couldn't succeed.

Thanks in advance,
Venu
--
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter question

2008-12-01 Thread [EMAIL PROTECTED]
On Oct 26, 7:02 am, Chuckk Hubbard [EMAIL PROTECTED]
wrote:
 Hello.
 How about this?  I changed the if statements so the coordinates are
 always updated, but only changed if within the right limits, otherwise
 updated to the existing value.  Now if you drag outside the limits of
 one dimension, it still moves in the other dimension.  Not sure if
 that's what you want.  I'm amazed that this can be so simple, I came
 up with an intricate system for my app, not realizing I could bind
 events to canvas items!
 BTW, I've never come across csoundroutines, can you give me a synopsis
 of what it's for?  I'm using thePythonCsoundAPI.  This is why I
 commented out all the references to csoundroutines, I don't have it
 installed at the moment.
 -Chuckk

 #!/usr/bin/python
 from Tkinter import *
 #import csoundroutines as cs

 root = Tk()

 global canv
 xx = {}

 def makeFrame(root):
   global canv
 #  test = cs.csdInstrumentlist3('bay-at-night.csd')
   canv = Canvas (root, height = 200, width = 350)

 #  for i in range (0, len(test.instr_number)):
   for i in range (0, 4):
 #    canv.create_text(10, i *10, text=str(test.instr_number[i]) +
     canv.create_text(10, i *10, text=str(i) +
 '...', tags=('movable'))
     xx[i] = canv.tag_bind('movable', 'B1-Motion', slide) #B1-motion
 is a drag with left button down
     canv.pack()

 def slide (event):
   '''
   triggered when something is dragged on the canvas - move thing
 under
 mouse ('current') to new position
   '''
   if 0  event.x  200:
       newx = event.x
   else: newx = canv.coords('current')[0]
   if 0  event.y  100:
     newy = event.y
   else: newy = canv.coords('current')[1]
   canv.coords('current', newx, newy)

 makeFrame(root)
 root.mainloop()





 On Fri, Oct 3, 2008 at 3:44 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  I saw this (close to this anyway) lieing around on the internet and
  was wanting to use it to define a start point exc but I need the
  graphics to stay within a set y coords and I am not realy sure how to
  do that.  I have no idea on how to bind a min/max y to it.  (the
  concept is inspired by the javacsoundblue).

  #!/usr/bin/python
  from Tkinter import *
  import csoundroutines as cs

  root = Tk()

  global canv
  xx = {}

  def makeFrame(root):
    global canv
    test = cs.csdInstrumentlist3('bay-at-night.csd')
    canv = Canvas (root, height = 200, width = 350)

    for i in range (0, len(test.instr_number)):
      canv.create_text(10, i *10, text=str(test.instr_number[i]) +
  '...', tags=('movable'))
      xx[i] = canv.tag_bind('movable', 'B1-Motion', slide) #B1-motion
  is a drag with left button down
      canv.pack()

  def slide (event):
    '''
    triggered when something is dragged on the canvas - move thing
  under
  mouse ('current') to new position
    '''
    newx = event.x
    if event.y  10 and event.y  0:
      newy = event.y
      canv.coords('current', newx, newy)

  makeFrame(root)
  root.mainloop()
  --
 http://mail.python.org/mailman/listinfo/python-list

 --http://www.badmuthahubbard.com- Hide quoted text -

 - Show quoted text -

sorry to take so long to reply...  You should be able to find the
latest version of csound routines in the csound blog..  an older
version is in dex tracker available on source forge..
--
http://mail.python.org/mailman/listinfo/python-list


Re: tkinter question

2008-12-01 Thread [EMAIL PROTECTED]
On Oct 26, 7:02 am, Chuckk Hubbard [EMAIL PROTECTED]
wrote:
 Hello.
 How about this?  I changed the if statements so the coordinates are
 always updated, but only changed if within the right limits, otherwise
 updated to the existing value.  Now if you drag outside the limits of
 one dimension, it still moves in the other dimension.  Not sure if
 that's what you want.  I'm amazed that this can be so simple, I came
 up with an intricate system for my app, not realizing I could bind
 events to canvas items!
 BTW, I've never come across csoundroutines, can you give me a synopsis
 of what it's for?  I'm using thePythonCsoundAPI.  This is why I
 commented out all the references to csoundroutines, I don't have it
 installed at the moment.
 -Chuckk

 #!/usr/bin/python
 from Tkinter import *
 #import csoundroutines as cs

 root = Tk()

 global canv
 xx = {}

 def makeFrame(root):
   global canv
 #  test = cs.csdInstrumentlist3('bay-at-night.csd')
   canv = Canvas (root, height = 200, width = 350)

 #  for i in range (0, len(test.instr_number)):
   for i in range (0, 4):
 #    canv.create_text(10, i *10, text=str(test.instr_number[i]) +
     canv.create_text(10, i *10, text=str(i) +
 '...', tags=('movable'))
     xx[i] = canv.tag_bind('movable', 'B1-Motion', slide) #B1-motion
 is a drag with left button down
     canv.pack()

 def slide (event):
   '''
   triggered when something is dragged on the canvas - move thing
 under
 mouse ('current') to new position
   '''
   if 0  event.x  200:
       newx = event.x
   else: newx = canv.coords('current')[0]
   if 0  event.y  100:
     newy = event.y
   else: newy = canv.coords('current')[1]
   canv.coords('current', newx, newy)

 makeFrame(root)
 root.mainloop()





 On Fri, Oct 3, 2008 at 3:44 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  I saw this (close to this anyway) lieing around on the internet and
  was wanting to use it to define a start point exc but I need the
  graphics to stay within a set y coords and I am not realy sure how to
  do that.  I have no idea on how to bind a min/max y to it.  (the
  concept is inspired by the javacsoundblue).

  #!/usr/bin/python
  from Tkinter import *
  import csoundroutines as cs

  root = Tk()

  global canv
  xx = {}

  def makeFrame(root):
    global canv
    test = cs.csdInstrumentlist3('bay-at-night.csd')
    canv = Canvas (root, height = 200, width = 350)

    for i in range (0, len(test.instr_number)):
      canv.create_text(10, i *10, text=str(test.instr_number[i]) +
  '...', tags=('movable'))
      xx[i] = canv.tag_bind('movable', 'B1-Motion', slide) #B1-motion
  is a drag with left button down
      canv.pack()

  def slide (event):
    '''
    triggered when something is dragged on the canvas - move thing
  under
  mouse ('current') to new position
    '''
    newx = event.x
    if event.y  10 and event.y  0:
      newy = event.y
      canv.coords('current', newx, newy)

  makeFrame(root)
  root.mainloop()
  --
 http://mail.python.org/mailman/listinfo/python-list

 --http://www.badmuthahubbard.com- Hide quoted text -

 - Show quoted text -

 haven't tried this yet but I look foward to trying it out..
--
http://mail.python.org/mailman/listinfo/python-list


python 2.5.2 or Python 2.6 compilation problem on AIX 5.3

2008-12-01 Thread [EMAIL PROTECTED]
Hello:
I am trying to compile Python 2.5.2 on AIX 5.3 with gcc 4.2.3. I am
getting following error. (I also tried Python 2.6 with same error)

creating build/temp.aix-5.3-2.5/share/tmhsdsd2/tmp/Python-2.5.2/
Modules
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -I. -I/share/tmhsdsd2/tmp/Python-2.5.2/./Include -
I. -IInclude -I./Include -I/usr/local/include -I/share/tmhsdsd2/tmp/
Python-2.5.2/Include -I/share/tmhsdsd2/tmp/Python-2.5.2 -c /share/
tmhsdsd2/tmp/Python-2.5.2/Modules/_struct.c -o build/temp.aix-5.3-2.5/
share/tmhsdsd2/tmp/Python-2.5.2/Modules/_struct.o
creating build/lib.aix-5.3-2.5

./Modules/ld_so_aix gcc -pthread -bI:Modules/python.exp build/
temp.aix-5.3-2.5/share/tmhsdsd2/tmp/Python-2.5.2/Modules/_struct.o -L/
usr/local/lib -lpython2.5 -o build/lib.aix-5.3-2.5/_struct.so
collect2: library libpython2.5 not found
*** WARNING: renaming _struct since importing it failed:
0509-022 Cannot load module build/lib.aix-5.3-2.5.
0509-026 System error: A file or directory in the path name
does not exist.
error: No such file or directory
make: 1254-004 The error code from the last command is 1.


Stop.


I am not able to find the problem. I would appreciate, if you could
help. I used following command line options to confugure.
 ./configure --prefix=/home/hci/dinakar/python25 -enable-shared --with-
gcc

Thank you.
Dinakar
--
http://mail.python.org/mailman/listinfo/python-list


Re: python 2.5.2 or Python 2.6 compilation problem on AIX 5.3

2008-12-01 Thread [EMAIL PROTECTED]
On Dec 1, 1:06 pm, Terry Reedy [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  Hello:
  I am trying to compile Python 2.5.2 on AIX 5.3 with gcc 4.2.3. I am
  getting following error. (I also tried Python 2.6 with same error)

  creating build/temp.aix-5.3-2.5/share/tmhsdsd2/tmp/Python-2.5.2/
  Modules
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
  Wstrict-prototypes -I. -I/share/tmhsdsd2/tmp/Python-2.5.2/./Include -
  I. -IInclude -I./Include -I/usr/local/include -I/share/tmhsdsd2/tmp/
  Python-2.5.2/Include -I/share/tmhsdsd2/tmp/Python-2.5.2 -c /share/
  tmhsdsd2/tmp/Python-2.5.2/Modules/_struct.c -o build/temp.aix-5.3-2.5/
  share/tmhsdsd2/tmp/Python-2.5.2/Modules/_struct.o
  creating build/lib.aix-5.3-2.5

  ./Modules/ld_so_aix gcc -pthread -bI:Modules/python.exp build/
  temp.aix-5.3-2.5/share/tmhsdsd2/tmp/Python-2.5.2/Modules/_struct.o -L/
  usr/local/lib -lpython2.5 -o build/lib.aix-5.3-2.5/_struct.so
  collect2: library libpython2.5 not found

 Have you checked all the directories on PATH to see if any contain
 libpython2.5?


Thanks for your response. libpython2.5.a is in the current directory
same as Makefile.

Thank you.
Dinakar
--
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread [EMAIL PROTECTED]
On Nov 29, 3:44 pm, Josh [EMAIL PROTECTED] wrote:
 If you were a beginning programmer and willing to make an investment in
 steep learning curve for best returns down the road, which would you pick?

 I know this topic has been smashed around a bit already, but 'learning
 curve' always seems to be an arguement. If you feel that one is easier
 or harder than the others to learn feel free to tell, but let's not make
 that the deciding factor. Which one will be most empowering down the
 road as a development tool?

I'd strongly recommend not using an IDE but going with federated
tools; this makes it easier to pick the editor, code navigation tool,
build system, etc that you like best, and makes it easier to swap out
one piece at a time if you don't like it.  So of the choices
mentioned, I'd go with emacs or vim if I were you.

Personally I also find high value in picking an editor that can be run
on a command-line terminal connection (e.g. when you're ssh'd into a
remote server), but that may be less important depending on what sort
of development you are doing.
--
http://mail.python.org/mailman/listinfo/python-list


Unofficial Phone, , the most cheap mobile phones from china , 30 kinds today

2008-11-30 Thread [EMAIL PROTECTED]
 Unofficial Phone, ,the most cheap mobile phones from china ,30 kinds
today

http://www.unofficialphone.cn/2008/11/android-phone-cottage-sciphone-dream-g2.html
http://www.unofficialphone.cn/2008/11/unofficial-phone.html
http://www.unofficialphone.cn/2008/11/amanilan.html
http://www.unofficialphone.cn/2008/11/6191-pairs-of-mastercard-networks.html
http://www.unofficialphone.cn/2008/11/absolute-all-round-champion-sanq-g28.html
http://www.unofficialphone.cn/2008/11/taiwan-friends-of-walled-g-plus-ct680.html
http://www.unofficialphone.cn/2008/11/hong-tianlei-zhensi-zh989-bone-nerve.html
http://www.unofficialphone.cn/2008/11/1g-ram-gps-telsda-811-smartphone-new.html
for more
http://www.unofficialphone.cn
--
http://mail.python.org/mailman/listinfo/python-list


pydoc enforcement.

2008-11-30 Thread [EMAIL PROTECTED]
I've been thinking about implementing (although no idea yet *HOW*) the
following features/extension for the python compile stage and would be
interested in any thoughts/comments/flames etc.

Basically I'm interested adding a check to see if:
  1) pydoc's are written for every function/method.
  2) There are entries for each parameter, defined by some
predetermined syntax.

My idea is that as much as I love dynamic typing, there are times when
using some modules/API's that have less than stellar documentation. I
was thinking that if it was possible to enable some switch that
basically forced compilation to fail if certain documentation criteria
weren't met.

Yes, it should be up to developers to provide documentation in the
first place. Or, the client developer might need to read the source
(IF its available)...  but having some forced documentation might at
least ease the problem a little.

For example (half borrowing from Javadoc).

class Foo( object ):

  def bar( self, ui ):
 pass


Would fail, since the bar method has an unknown parameter called
ui.
What I think could be interesting is that the compiler forces some
documentation such as:

class Foo( object ):

  def bar( self, ui ):

@Param: ui :  blah blah blah.

 pass


The compiler could check for @Param matching each parameter passed to
the method/function. Sure, a lot of people might just not put a
description in, so we'd be no better off. But at least its getting
them *that* far, maybe it would encourage them to actually fill in
details.

Now ofcourse, in statically  typed language, they might have the
description as Instance of UIClass or something like that. For
Python, maybe just a description of Instance of abstract class UI or
List of Dictionaries...  or whatever. Sure, precise class names
mightn't be mentioned (since we mightn't know what is being used
then), but having *some* description would certainly be helpful (I
feel).

Even if no-one else is interested in this feature, I think it could
help my own development (and would be an interested first change
into Python itself).

Apart from bagging the idea, does anyone have a suggestion on where in
the Python source I would start for implementing such an idea?

Thanks

Ken

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


Cross platform desktop operations in Python

2008-11-30 Thread [EMAIL PROTECTED]
Hi

I'm looking for a cross platform (Linux/Win/Mac) solution of common
desktop operations like:
* Getting system icon theme (icons for files, folders etc.)
* Determine mimetype (better than mimetypes using mapped extension to
mime)

Under Unix/Linux there are freedesktop.org standards and pyxdg that
can do that, but it won't work for example on Windows. Are there
solutions for this, or do I have to implement a backed for every
system?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Emacs vs. Eclipse vs. Vim

2008-11-29 Thread [EMAIL PROTECTED]
On Nov 29, 12:44 pm, Josh [EMAIL PROTECTED] wrote:
 If you were a beginning programmer and willing to make an investment in
 steep learning curve for best returns down the road, which would you pick?

 I know this topic has been smashed around a bit already, but 'learning
 curve' always seems to be an arguement. If you feel that one is easier
 or harder than the others to learn feel free to tell, but let's not make
 that the deciding factor. Which one will be most empowering down the
 road as a development tool?

 Thanks in advance,

 JR

I have experience with Vim and Emacs, none with Eclipse. I used Emacs
exclusively until summer 2007 at which point I switched to Vim and
never looked back. To be perfectly honest, the switch was precipitated
by peer pressure, basically one of my friends said, Emacs, you mean
people still use that? I thought everyone switched to Vi, or rather
Vim, a long time ago. Nevertheless, I am happy that I made the
change.

At any rate, if you are willing to learn Lisp and pour over the Emacs
manuals from time to time, then Emacs may be for you. If you like
programming in Lisp then you may find it appealing and fun to write
Emacs extensions and utilities for your own needs. If the Lisp way
rubs your fur in the wrong direction, then Emacs may not be for you.

Vim has a different approach. The learning curve is substantial at the
beginning (softened by the Vim book), but at the end of the day I am
able to move around and manipulate code with less effort, mostly due,
I think, to having multiple modes: insert, visual, normal.

If you really are learning programming, then pick up a copy of SICP,
download Emacs, and veg out for a year and a half ducks for cover.

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


Problem with py2exe when using bundle_files and pygtk/pygobject

2008-11-27 Thread [EMAIL PROTECTED]
Hi,

I am using py2exe with pygtk and everything works fine. But when I set
bundle_files to 1 or 2, I get following exception, when starting the
binary:

Traceback (most recent call last):
  File startup.py, line 1, in module
  File zipextimporter.pyc, line 82, in load_module
  File foo.pyc, line 4, in module
  File zipextimporter.pyc, line 82, in load_module
  File gtk\__init__.pyc, line 38, in module
  File zipextimporter.pyc, line 82, in load_module
  File gobject\__init__.pyc, line 30, in module
  File zipextimporter.pyc, line 82, in load_module
  File gobject\constants.pyc, line 22, in module
  File zipextimporter.pyc, line 98, in load_module
ImportError: MemoryLoadLibrary failed loading gobject\_gobject.pyd

I have found this error message under
http://www.py2exe.org/index.cgi/ProblemsToBeFixed with the comment
This error occur when no msvcp71.dll found - add this dll to program
or windows/system32 director. But because of I am using Windows XP,
there is msvcp71.dll under C:\Windows\system32.

I figured out that gobject\_gobject.pyd is into the zipfile and
zipextimporter can even read it. But MemoryLoadLibrary as called by
import_module returns NULL.

I am using py2exe 0.6.9 for 32-bit with Python 2.5 on Windows XP SP2
and my setup.py is listed below.

from distutils.core import setup
import py2exe

setup(name='foo',
   version='1.0',
   options= {
   'py2exe': {
   'bundle_files': 1,
   'includes': 'cairo, pango, pangocairo, atk,
gobject'
   }
   },
   windows = ['startup.py'],
   py_modules=['foo'])

This seems to me as a bug in the MemoryLoadLibrary code or I am doing
something wrong? Does somebody have successful bundled an application
using pygtk with py2exe and can tell me what has he done to do so and
which versions of py2exe, Python and Windows he was using? Thanks.

Regards
Sebastian Noack
--
http://mail.python.org/mailman/listinfo/python-list


converting a string data to a float value for access database

2008-11-25 Thread [EMAIL PROTECTED]
Hi,

I am trying to copy a sql database to a access database using python.
I can copy all the fields, but the date.  I can store a float value in
access data object, ie 
http://en.wikibooks.org/wiki/JET_Database/Data_types#Dates_and_times

So access uses a float for a date, and mysql databse uses text, I got
the following as the output 2008-11-25 09:59:39.
How can I convert the string 2008-11-25 09:59:39 from mysql to a float
for access??


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


Accessing Modification Time of an Outlook Mail in Python

2008-11-24 Thread [EMAIL PROTECTED]
Hi all,
   I am writing a small application which reads the contents of an
Outlook Mail using python. I am able to read the contents, subject
along with senders and receivers of a mail using MAPI objects. But may
I know how can I get access to the modification time or the
receiving time of an outlook mail in Python. For the others I have
used message object of MAPI session. Here I am pasting a sample code
to get an idea of what am I doing.


session = Dispatch(MAPI.session)
session.Logon('outlook')  # MAPI profile name
inbox = session.Inbox

print Inbox name is:, inbox.Name
print Number of messages:, inbox.Messages.Count

for i in range(inbox.Messages.Count):
message = inbox.Messages.Item(i + 1)

objSender = message.Sender.Address
objRecip = message.Recipients.Item(j+1)


Now here I want to access the modification time of each mail. And if
possible if you can guide me to a place where I can get the elements
of that message object, that would be helpful.

 Please mail back for further information.
Thanks in advance,
Venu.
--
http://mail.python.org/mailman/listinfo/python-list


ROGER DUBUIS WATCHES

2008-11-24 Thread [EMAIL PROTECTED]
http://www.flyingzg.com/roger-dubuis-watches-c-113.html

Founded by Carlos Dias in 1995 as SOGEM SA (Socie`te` Genevoise des
Montres), the company did not lay claim to its current title of
Manufacture until 1999. In March 2001, he established the first
building of the Manufacture ROGER DUBUIS in the Meyrin industrial area
just outside the city of Geneva. This facility was to enable him to
undertake the process of verticalisation for the production of the
brand?s movements. Inaugurated in April 2002, this first building
features timeless architecture based on glass and metal expressing a
pure, modern design concept. Two years later, work began on a second
building to extend the production units of the Manufacture and which
naturally served to increase brand visibility. Since achieving
complete independence in 2003, the Manufacture ROGER DUBUIS conceives,
develops and produces not only its simple, complicated and extremely
complicated movements, but also the regulating organs with which they
are equipped. The balance-springs and balances, as indeed all other
movement parts, are produced in-house.With Roger Dubuis replica
watches you will be really successful! We`ll be pleased to submit you
the similar quality replica Roger Dubuis watches but cheaper than
original ones.
--
http://mail.python.org/mailman/listinfo/python-list


Re: credit kredite oesterreich ratenkredite online kredit ohne schufa in blitzkredite

2008-11-20 Thread [EMAIL PROTECTED]
On Nov 12, 2:06 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 credit kredite oesterreich ratenkredite online kredit ohne schufa in
 blitzkredite

 +
 +
 +
 +
 +++ GUENSTIGE KREDITE ONLINE +++ KREDITE IM INTERNET OHNE SCHUFA +++
 +


http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1
http://www.fme.gov.ng/forum/forum_posts.asp?TID=4785PN=1

 kredit privatkredite in Dietzenbach
 beamtenkredite darlehen ohne schufa in Marktoberdorf
 bargeld kredite bon kredit ohne schufa in Wittgenstein
 kredite schufa kredit umschuldung in Eberswalde
 online kredite ohne schufa beamtendarlehen ohne schufa in
 Schwarzenberg
 kredit online vergleich finanzierung in Bad Hersfeld
 kredite kreditvermittlung ohne schufa in Wolfenbüttel
 online kredit trotz schufa von bonkredit in Forst

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


SOAPpy SyntaxError

2008-11-20 Thread [EMAIL PROTECTED]
Hello,

I'm going through the SOAP Web Services portion of Mark Pilgrim's
tutorial and I'm getting this error when trying to build:

python setup.py build
Traceback (most recent call last):
  File setup.py, line 8, in module
from SOAPpy.version import __version__
  File /Users/username/Desktop/SOAPpy-0.12.0/SOAPpy/__init__.py,
line 5, in module
from Client  import *
  File /Users/username/Desktop/SOAPpy-0.12.0/SOAPpy/Client.py, line
46
from __future__ import nested_scopes
SyntaxError: from __future__ imports must occur at the beginning of
the file

I tried moving that line and it didn't help.

Thanks,

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


Re: Python image library issue: domain users cannot save files?

2008-11-20 Thread [EMAIL PROTECTED]
I have no problem with the python builtin open which we use dayly.
Thanks for the hints.

Best,
V

On Nov 19, 5:56 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
 En Wed, 19 Nov 2008 13:43:07 -0200, [EMAIL PROTECTED]  
 [EMAIL PROTECTED] escribió:

  Has anyone try to use PIL in a windows domain environment? I am having
  a permission issue. If I am a domain user, even I have the permission
  to write a folder, when I tried to do simple things like Image.open
  (foo.tif).save(bar.tif), i am getting exception IOError (0,
  Error). I tried to set os.umask(0) before I saved the file but the
  same exception threw. But If I am the same domain user with local
  admin permission on a windows box, I have no problem with the same
  script. Does anyone ever have the same situation and know a work
  around for this? Thanks.

 Try using the builtin open() function to create/read/write files. If you  
 have the same issues then you can take away PIL from the question and  
 concentrate on setting the proper permissions for the user running the  
 script.

 --
 Gabriel Genellina

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


Python image library issue: domain users cannot save files?

2008-11-19 Thread [EMAIL PROTECTED]
Hi,
Has anyone try to use PIL in a windows domain environment? I am having
a permission issue. If I am a domain user, even I have the permission
to write a folder, when I tried to do simple things like Image.open
(foo.tif).save(bar.tif), i am getting exception IOError (0,
Error). I tried to set os.umask(0) before I saved the file but the
same exception threw. But If I am the same domain user with local
admin permission on a windows box, I have no problem with the same
script. Does anyone ever have the same situation and know a work
around for this? Thanks.

Best,

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


Re: zope vs openACS

2008-11-19 Thread [EMAIL PROTECTED]
On Nov 19, 1:50 am, gavino [EMAIL PROTECTED] wrote:
 what is nicer about each?

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


Re: special editor support for indentation needed.

2008-11-15 Thread [EMAIL PROTECTED]
On Nov 14, 9:01 pm, Eric S. Johansson [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
   I don't understand. If you don't want to terminate the if, why do
  you hit backspace? What is it that you would like to have happen?

 the goal is to make some aspects of indentation behave the same without 
 context
 dependency.  this goal exists for many features of programming assistance
 because it's a prerequisite for lowering the vocal load for this aspect of
 programming by voice

 I want three indentation adjustment tools.  Indent to where a class should be,
 indent to where a method should be, and outdent n levels (close block
 (once|twice|thrice)).  This is probably best shown by example although, I'm 
 not
 guaranteeing my example will make it any clearer.  :-)

 the current outdent capability conflates multiple outdent events.  The outdent
 events are, at a minimum,:

 Close block
 close method
 close class

 Another way to look at these events are start method, start class and close
 block.  Now using these events, let's compare a use case against the outdent
 mechanism.

 starting with an example of a previous message,

 class pet (object):
     
     
     def cat(self):
         
         
         if food in bowl:
             self.empty = True

     def dog(self):

 to start the dog method, after ending the Method, I would need to say 
 something
 like:

 newline tab key Close block close block delta echo foxtrot dog left paren self
 close paren colon...

 But if the method ended like:

     ...

     def cat(self):
         
         
         self.empty = True

     def dog(self):

 I would only want to use a single close block to outdent.  unfortunately, 
 this
  context dependent behavior is frustratingly wrong when it comes to creating
 speech driven macros to enter templates.  it requires user intervention to 
 tell
 you how may times to outdent and that's counterproductive at best and 
 physically
 damaging at worst for a disabled user.

 any clearer?
I still don't understand. It seems that you want to be able to do:
END_CLASS  to end the current class.

END_DEF to end the current function

END_BLOCK to end anything else.

This is possible with some emacs lisp but I don't see what this gains
you over
BACK BACK BACK
  where BACK sends a backspace to emacs.
  (Actually I'd define an END command which you could give at the
end of the last line of a block. That would relieve you of the need to
enter the newline and tab.)
  Yes, it requires a few extra utterances on occasion, but you don't
have to worry about three new (multi-syllabic) verbs to recognize.

 Am I understanding your requirement correctly?
--
http://mail.python.org/mailman/listinfo/python-list


The Best Way To earn Money From The Internet

2008-11-15 Thread [EMAIL PROTECTED]

http://bux.to/?r=mr-sk8er
At Bux.to, you get paid to click on ads and visit websites. The
process is easy! You simply click a link and view a website for 30
seconds to earn money. You can earn even more by Referring Friends.
You'll get paid $0.01 for each website you personally view and $0.01
for each website your referrals view. Payment requests can be made
every day and are processed through Papal. The minimum payout is
$10.00.
U don’t have a paypal account
Its for free from here www.paypal.com
Earnings Example:
» You click 10 ads per day = $0.10
» 20 referrals click 10 ads per day = $2.00
» Your daily earnings = $2.10
» Your weekly earnings = $14.70
» Your monthly earnings = $63.00
The above example is based only on 20 referrals and 10 daily clicks.
Some days you will have more clicks available, some days you will have
less. What if you had more referrals? What if there were more ads
available?
Click here to sign up http://bux.to/?r=mr-sk8er
How Bux.to works

How you make money
You view websites in 30 second sessions via the Surf Ads page. Once
the 30 seconds is up, you'll either get a green tick sign or a red
'X'. The green tick sign means you've earned $0.01 and as premium
member $0.0125 for the visit and the 'X' means you have not earned
money for the visit. You'll get red X's when you have more than one
website from the Surf Ads page open. When this happens, you get no
credit.

A valuable benefit to both the members and the advertisers is the
repeat exposure that the advertiser gets. Whenever you click and view
a website, you can visit that website again in 24 hours as long as the
visit cap hasn't been reached. That's right! After 24 hours you can
click and view the website again. This gives the advertiser optimal
exposure by using repeat advertising and it further increases the
members earning potential.

you can also buy referrals packages
You can purchase 500 of these un-referred Bux.to members for a price
of only $459.00. This is an extremely low price to pay when you sit
back and imagine your profits. In fact, based on averages, 500 active
referrals can bring you
» 500 referrals click 10 ads per day = $50.00
» Your daily earnings = $50.00
» Your weekly earnings = $350.00
» Your monthly earnings = $1,500.00
Are u still waiting???
Signup from here http://bux.to/?r=mr-sk8er

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


Need help in understanding a python code

2008-11-15 Thread [EMAIL PROTECTED]
Hi,

I am trying to understand the following line:
# a is an integer array

max([(sum(a[j:i]), (j,i))

Can you please tell me what that means,
I think sum(a[j:i] means find the some from a[j] to a[i]
But what is the meaning of the part (j,i)?

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


Looking for traffic generating utility (like ping)

2008-11-14 Thread [EMAIL PROTECTED]
Hello, I am looking for a utility that will generate any number of
pings per second, and allow me to check how many of the pings in the
last X seconds have been dropped, while it is still running.

The reason I can't use the built-in Unix ping is that 1) it does not
provide overall feedback while it is still running, and 2) It would be
difficult to determine how many pings have been lost in the last X
seconds, due to the possibility of out-of-order ping replies and other
such problems. (Also, 3: it seems like it would be inefficient and
unreliable to read the lines of output, especially since I plan to
generate a high number of pings per second (likely over 1000/sec)).

Ideally, I'd like the interface to be like this: 1) I start the
utility and give it the target IP address, the number of pings it
should send every second, and the number of seconds (X) it should look
back when I request a report. 2) I make some sort of request of the
utility, and it tells me how many pings were sent out in the last X
seconds, and how many were received. I should be able to do this
multiple times before termination. 3) I terminate the utility, and it
gives me overall statistics; most importantly, overall number of pings
sent, and overall number received.

Does anyone know of a Python module that could help me here, or a ping
utility? If not, is there a better way to do this than simply
generating a thread which runs ping -i [interval] [IP]?

Thanks for any and all help,
Aaron
--
http://mail.python.org/mailman/listinfo/python-list


Re: special editor support for indentation needed.

2008-11-14 Thread [EMAIL PROTECTED]
On Nov 14, 4:08 pm, Eric S. Johansson [EMAIL PROTECTED] wrote:
 Almar Klein wrote:
  Hi Eric,

  First of all, I like your initiative.

 there's nothing like self interest to drive one's initiative.  :-) 14 years 
 with
 speech recognition and counting.  I'm so looking to my 15th anniversary of 
 being
 injured next year

 another initiative is exporting the speech recognition environment to the 
 Linux
 context.  In a nutshell, he dictated to application on Windows, it tunnels 
 over
 the network to a Linux machine, and will allow you to cut and paste to and 
 from
 that Linux application.  I could definitely use some high quality volunteer
 talent for this effort.   it would make a huge quality of life difference to
 disabled developers.    This work would also be usable by the folks in the 
 wine
 project who are supporting  NaturallySpeaking.

  I'm not sure if I undestand you correctly, but can't you just
  increase indentation after each line that ends with a colon?
  That's how I do it in my editor. The user would then only need
  to specify when to decrease indentation.

 here's an example of the problem:
 class foo( object):
     def cat(self)
         self.x=1
         def dog
             self.x=2

 this is legal Python but it's not what you need 99% of the time.  There is no
 cue to the editor to tell it to outdent to give me what I really want which 
 is:

 class foo( object):
     def cat(self)
         self.x=1
     def dog
         self.x=2

 so there should be a mechanism for saying indent the level of the previous
 definition.  For what it's worth, this would translate in speech recognition 
 of
 arm in vocola pseudocode to

 new  method = def indentdef ^(self):{enter}{enter}{enter}srch 
 backwards
 and delete ^

 which would allow me to create a method definition and put me back at a place
 where I can speak the method name.  There's other stuff in these be done like
 allowing you to modify various features by names such as adding/deleting
 arguments, modifying array indices etc.  If you are not careful, I'll talk 
 about
 command disambiguation through scope reduction and the related visual elements
 in the working environment.

 I really need a job doing this UI stuff.  :-)

The backspace key in emacs does exactly what you want. Have you tried
it?

For python.el, distributed with Gnu Emacs:
 DEL (translated from backspace) runs the command python-backspace,
which is an interactive compiled List function in `python.el`

For python-mode.e, distributed with XEmacs (but usable with Gnu
Emacs):
 DEL (translated from backspace) runs the command py-electric-
backspace, which
is an interactive compiled Lisp function in `python-mode.el'.


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


Re: special editor support for indentation needed.

2008-11-14 Thread [EMAIL PROTECTED]
On Nov 14, 5:27 pm, Eric S. Johansson [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
  On Nov 14, 4:08 pm, Eric S. Johansson [EMAIL PROTECTED] wrote:
  Almar Klein wrote:
  Hi Eric,
  First of all, I like your initiative.
  there's nothing like self interest to drive one's initiative.  :-) 14 
  years with
  speech recognition and counting.  I'm so looking to my 15th anniversary of 
  being
  injured next year

  another initiative is exporting the speech recognition environment to the 
  Linux
  context.  In a nutshell, he dictated to application on Windows, it tunnels 
  over
  the network to a Linux machine, and will allow you to cut and paste to and 
  from
  that Linux application.  I could definitely use some high quality volunteer
  talent for this effort.   it would make a huge quality of life difference 
  to
  disabled developers.    This work would also be usable by the folks in the 
  wine
  project who are supporting  NaturallySpeaking.

  I'm not sure if I undestand you correctly, but can't you just
  increase indentation after each line that ends with a colon?
  That's how I do it in my editor. The user would then only need
  to specify when to decrease indentation.
  here's an example of the problem:
  class foo( object):
      def cat(self)
          self.x=1
          def dog
              self.x=2

  this is legal Python but it's not what you need 99% of the time.  There is 
  no
  cue to the editor to tell it to outdent to give me what I really want 
  which is:

  class foo( object):
      def cat(self)
          self.x=1
      def dog
          self.x=2

  so there should be a mechanism for saying indent the level of the previous
  definition.  For what it's worth, this would translate in speech 
  recognition of
  arm in vocola pseudocode to

  new  method = def indentdef ^(self):{enter}{enter}{enter}srch 
  backwards
  and delete ^

  which would allow me to create a method definition and put me back at a 
  place
  where I can speak the method name.  There's other stuff in these be done 
  like
  allowing you to modify various features by names such as adding/deleting
  arguments, modifying array indices etc.  If you are not careful, I'll talk 
  about
  command disambiguation through scope reduction and the related visual 
  elements
  in the working environment.

  I really need a job doing this UI stuff.  :-)

  The backspace key in emacs does exactly what you want. Have you tried
  it?

 yes and it doesn't work right.  Type this in:

 class pet (object):
     
     
     def cat(self):
         
         
         if food in bowl:
             self.empty = True

     def dog(self):
         
         
         if food in bowl:
             self.empty = True
         else:
             self.bark_nonstop()

  at the end of the method cat, a newline puts you at the left-hand margin and 
 a
 subsequent tab  lines you up with self.empty.  Pressing backspace at that 
 point,
 terminates the if.  It's reasonable behavior and should be useful when 
 assigned
 to the close block utterance.  But remember, my goal is to have a variety of
 options for selecting the correct level of indentation with my eyes closed.
 Speaking a lot to get a little effect is dangerous to the health of one's 
 vocal
 cords and, a text-to-speech output doesn't let you know what lines up with 
 what.
 I don't understand. If you don't want to terminate the if, why do
you hit backspace? What is it that you would like to have happen?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Installing packages

2008-11-13 Thread [EMAIL PROTECTED]
On Nov 13, 2:25 pm, Alan Baljeu [EMAIL PROTECTED] wrote:
 I'm new to Python, and just downloaded Py2.6.  I also want to use Nose.  So I 
 downloaded the latest sources, but it's not at all clear what's the best way 
 to put this stuff into the Python package system.  Nose supports 
 easy_install, easy_install doesn't have an installer for Windows and Py2.6, 
 so I think I can't use that.  (It only does 2.5 and earlier.  (Should I go to 
 Py2.5?  Is there more support out there for that?)).  

 Alan Baljeu
You are the second poster today concerned about the lack of setuptools
for Py2.6
All you have to do is download the setuptools source and run:
  C:\Python26\python setup.py install

You'll need a compatible compiler (Visual Studio Express 2008 works
fine) but if you're running Python on Windows you should have that
anyway or you'll forever be at the mercy of the packagers.


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


Re: Python 2.5 and sqlite

2008-11-12 Thread [EMAIL PROTECTED]
Thanks to everyone who replied. I should have been clearier with my
initial post. Python (2.5.1) was compiled from source on the webserver
that I use, without an associated sqlite present on the machine, so
trying import sqlite3 in a python application gives an error, but
aside from that python is mostly behaving itself.  Again further
clarification, the webserver is a sun machine, my machine is linux and
all drives of all machine in the network are mounted, so a
ssh,telnet,rlogin is not required to gain access to other machines.

Now with that out of the way, I'm still not clear if I can install a
copy of sqlite on my local machine and get that to work with python on
the webserver? Possibly via pysqlite?

On Nov 12, 8:46 am, Thorsten Kampe [EMAIL PROTECTED] wrote:
 *  (Tue, 11 Nov 2008 17:58:15 -0500)

Can you ask them if sqlite3 is installed? and if not... to install
it?

   Why would he have to install SQLite?!

  Seems a stupid question. If he wants to use SQLite... it needs to be
  on the system

 No.



  ould include in your discussions well sqlite3 is part of python
if it isn't, you haven't installed python properly

   Sqlite3 is an optional part of Python.

  But Python itself is dependent upon SQlite3 being installed first...

  try it yourself...

  first compile python 2.5 from source without SQLite.. see if it
  works... it won't.

  Install Sqlite first... then compile python 2.5 from source.. python
  sqlite support will work...

  The dependency is within the make files of python 2.5. It checks
  whether sqlite is installed on the machine and includes support if it
  is there.. if not.. doesn't support it...

  It is very logical

 Not at all. If you would distribute a script that uses SQLite and it
 would depend on whether SQLite is installed or not that would be a
 huge disadvantage.

 Python cannot check whether SQLite is installed or not. It checks
 whether it can find the SQLite header files. So the SQLite source (or
 the binary) is only needed for compiling Python. If you build SQLite
 support as a shared library, you need the libsqlite package (not the
 SQLite binary itself) at runtime. If you build it static, you don't need
 SQLite at all at runtime. See Martin's answer in the same thread.

 Thorsten

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


credit kredite oesterreich ratenkredite online kredit ohne schufa in blitzkredite

2008-11-12 Thread [EMAIL PROTECTED]
credit kredite oesterreich ratenkredite online kredit ohne schufa in
blitzkredite

+
+
+
+
+++ GUENSTIGE KREDITE ONLINE +++ KREDITE IM INTERNET OHNE SCHUFA +++
+
+
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html
http://www.usd.edu/phys/courses/astronomy/bord/messages/19924.html






















kredit privatkredite in Dietzenbach
beamtenkredite darlehen ohne schufa in Marktoberdorf
bargeld kredite bon kredit ohne schufa in Wittgenstein
kredite schufa kredit umschuldung in Eberswalde
online kredite ohne schufa beamtendarlehen ohne schufa in
Schwarzenberg
kredit online vergleich finanzierung in Bad Hersfeld
kredite kreditvermittlung ohne schufa in Wolfenbüttel
online kredit trotz schufa von bonkredit in Forst










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


Re: Python 2.5 and sqlite

2008-11-12 Thread [EMAIL PROTECTED]
On Nov 12, 10:14 am, Thorsten Kampe [EMAIL PROTECTED] wrote:
 * [EMAIL PROTECTED] (Wed, 12 Nov 2008 01:27:01 -0800 (PST))

  Python (2.5.1) was compiled from source on the webserver that I use,
  without an associated sqlite present on the machine, so trying import
  sqlite3 in a python application gives an error, but aside from that
  python is mostly behaving itself. Again further clarification, the
  webserver is a sun machine, my machine is linux and all drives of all
  machine in the network are mounted, so a ssh,telnet,rlogin is not
  required to gain access to other machines.

  Now with that out of the way, I'm still not clear if I can install a
  copy of sqlite on my local machine and get that to work with python on
  the webserver? Possibly via pysqlite?

 No, if Python was compiled without SQLite support or pysqlite is not
 installed on that machine it will not run anything SQLite related.

 Thorsten


ok, thanks for the clarification Thorsten. would it be the same
situation trying to get another db such as MySQL or PostgreSQL working?
--
http://mail.python.org/mailman/listinfo/python-list


Re: C Module question

2008-11-10 Thread [EMAIL PROTECTED]
On Nov 10, 1:16 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
 On Mon, 10 Nov 2008 03:11:06 -0800, [EMAIL PROTECTED] wrote:
  1. How can I pass a file-like object into the C part? The PyArg_*
  functions can convert objects to all sort of types, but not FILE*.

 http://docs.python.org/c-api/file.html#PyFile_AsFile

Yes, got it. At first I thought I had to use the Parse functions for
my args, but in fact I can of course just access the args as a tuple
(and then do the type checking myself).

 Why passing it in and out?  Simply use the C module level to store the
 information.

But if I create several instances of a class (in the wrapper module)
my C methods won't know which object they were called on.

robert

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


Re: C Module question

2008-11-10 Thread [EMAIL PROTECTED]
On Nov 10, 2:23 pm, Floris Bruynooghe [EMAIL PROTECTED]
wrote:

 Sorry, I probably should have mentioned you want to cast the object to
 PyFileObject and then use the PyFile_AsFile() function to get the
 FILE* handle.

Yes, I figured that out by now. Sadly this doesn't work on file-like
objects like those that are created by opening bz2 files (using the
bz2 lib). Not that I have any idea on how that should work anyway.

I still can resolve this issue in my wrapper module and let the C part
deal with the raw buffer contents.

All in all I must say that implementing a C extension is a piece of
cake. Had I known that it was this straightforward I wouldn't have
asked my questions in the first place. Making the whole thing more
robust will be a bit more difficult, and I need to find out how to
deal with ressources that are dynamically allocated on the C side.

But that should be easy, and I'll just keep all the Python OO and
Exceptions stuff in the wrapper and call my C stuff from there in a
more or less straightforward C manner.

Thanks to everybody for helping out,

robert
(I'll be back for sure)

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


C Module question

2008-11-10 Thread [EMAIL PROTECTED]
Hello,

I'm trying to write a Python extension module in C for the first time.
I have two questions:

1. How can I pass a file-like object into the C part? The PyArg_*
functions can convert objects to all sort of types, but not FILE*.

2. How can I preserve information needed in the C part between calls
to my module functions? The way I've thought of is:
- put this information in a dynamically allocated struct
- pass it out of and into the C module as CObject into/from an
intermediate Python wrapper module where it gets stored in a Python
object

Is this the way to do it?

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


Re: disable ctrl-P in idle?

2008-11-10 Thread [EMAIL PROTECTED]
On Nov 10, 3:27 pm, timw.google [EMAIL PROTECTED] wrote:
 On Nov 10, 2:57 pm, Robert Singer [EMAIL PROTECTED] wrote:



  On Mon, 10 Nov 2008 20:56:46 +0100, Robert Singer [EMAIL PROTECTED]
  wrote:

  On Mon, 10 Nov 2008 10:40:28 -0800 (PST), timw.google
  [EMAIL PROTECTED] wrote:

  Is there a way to disable ctrl-P (print window) in IDLE? I'm editing
  some python code in IDLE and I keep hitting this by mistake from my
  years of emacs editing.

  Thanks in advance.

  Try autohotkey and map it to something else. Like, nothing :-)

  Internally, I don't think so, it's part of CUI.

  -- Bob

  ... continue:
  Or, you can just continue using emacs. I'm using vim, and can't think
  of a single reason why I should change it for idle.

  -- Bob

 Thanks. I on a XP box now, and it's a pain to get things installed
 here. That's why I'm not using emacs. When I'm on Linux, I use emacs.
 It's not worth the trouble to install something else for just this.

It is not more difficult to install emacs on XP. What makes you think
that?
--
http://mail.python.org/mailman/listinfo/python-list


Python 2.5 and sqlite

2008-11-10 Thread [EMAIL PROTECTED]
Hi all,

On a (sun) webserver that I use, there is python 2.5.1 installed. I'd
like to use sqlite3 with this, however sqlite3 is not installed on the
webserver. If I were able to compile sqlite using a sun machine (I
normally use linux machines) and place this in my lunix home account
would I be able to use python and sqlite?

Any thoughts? I know its a bit of a stretch ...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Logging thread with Queue and multiple threads to log messages

2008-11-10 Thread [EMAIL PROTECTED]
Thank you guys, indeed, calling join() for each thread actually solved
the problem.
I misunderstood it and call join() right after start() so it didn't
work the way I wanted.

   for i in range(args.threads):
children[i].join()
--
http://mail.python.org/mailman/listinfo/python-list


Re: disable ctrl-P in idle?

2008-11-10 Thread [EMAIL PROTECTED]
On Nov 10, 4:49 pm, RichardT [EMAIL PROTECTED] wrote:
 On Mon, 10 Nov 2008 10:40:28 -0800 (PST), timw.google

 [EMAIL PROTECTED] wrote:
 Is there a way to disable ctrl-P (print window) in IDLE? I'm editing
 some python code in IDLE and I keep hitting this by mistake from my
 years of emacs editing.

 Thanks in advance.

 In Idle, select 'Configure IDLE..' from the options menu.

 In the Options dialog, select the Keys tab.

 Scroll down to the 'print-window' entry and select it.

 Click the Get New Keys For Selection button.

 Select the new key combination e.g. Shift+Ctrl+p and click OK button.

 If you have not enter any custom keys before, you will get a prompt
 for a Custom Key Set Name - enter a name and click OK.

For the archive, since our hero prefers not to receive credit.

 Ctrl+P should no longer send the window to the printer. On my system
 (python 2.5.1 on XP) it now moves the cursor up a line for some reason
 (deafult binding for the widget?)

Cursor up is the default emacs binding for Ctrl+P so this will
probably please the original poster (and me too!)

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


Plot for sale

2008-11-10 Thread [EMAIL PROTECTED]
SELL OUT land area with 12,681 ha, located at the entrance to the town
of Pazardzhik(Bulgaria) in  city limits and has 106 meters
individual . Dimcho Debelyanov (Miryansko road). A plot in the new
economic zone of the city - in the vicinity has built industrial
enterprises, shops and warehouses. Until the plot has built any
communications - trafopost, water supply, sewerage, telephone lines,
street lights, bus stop . MORE INFORMATION ON TEL: +359898408331 OR
COPY THIS LINKS:  http://www.youtube.com/watch?v=k14WAzpANJc  and
http://groups.google.com/group/propertybg
--
http://mail.python.org/mailman/listinfo/python-list


Logging thread with Queue and multiple threads to log messages

2008-11-09 Thread [EMAIL PROTECTED]
I am trying to put up a queue (through a logging thread) so that all
worker threads can ask it to log messages.  However, the problem I am
facing is that, well, the logging thread itself is running forever.
It does not know when it should exit.  Any suggestion?  None of the
worker threads knows for sure when the logging thread should exit
since they don't know what other worker threads are doing.  I also try
to set a time limit for the logging thread, but it does not work.


# mylogging.py - used by everyone else that needs to log messages
import threading
import Queue
import time

# This is the queue object that's used to hold log events.
# LoggingThread knows about it, and the log() function below
# knows about it.  No one else is allowed to see it.
_log_queue = Queue.Queue()

class LoggingThread(threading.Thread):
def __init__(self,logfile,duration):
threading.Thread.__init__(self)
self.logfile = logfile
self.duration = duration

def run(self):
f=open(self.logfile, 'w')
#it's probably not the right way to set an end time here
#since the logging thread should wait until all worker threads
are done
end = time.time() + self.duration + 10
while(end  time.time()):
message = _log_queue.get()
f.write(message + '\n')  # (or whatever)

f.close()

# Kick off the logging thread.
LoggingThread(logs/myapp.log,20).start()

def log(msg):
_log_queue.put(msg)




class Worker(threading.Thread):
def __init__(self,no,duration):
threading.Thread.__init__(self)
self.no = no
self.duration = duration

def run(self):
end = time.time() + self.duration

while(end  time.time()):
log('Thread Object (%d):(%d), Time:%s in seconds %d'%
(self.no,self.duration,time.ctime(),time.time()))
time.sleep(10)

print 'Done with worker (%d) at %s'%(self.no,time.ctime())



def main():
children = []
args = parseArgs()

for i in range(args.threads):
log('i=%d'%(i))
children.append(Worker(i,args.duration))
children[i].start()
time.sleep(0.1)
--
http://mail.python.org/mailman/listinfo/python-list


plot for sale

2008-11-07 Thread [EMAIL PROTECTED]
SELL OUT land area with 12,681 ha, located at the entrance to the town
of Pazardzhik(Bulgaria) in  city limits and has 106 meters
individual . Dimcho Debelyanov (Miryansko road). A plot in the new
economic zone of the city - in the vicinity has built industrial
enterprises, shops and warehouses. Until the plot has built any
communications - trafopost, water supply, sewerage, telephone lines,
street lights, bus stop . MORE INFORMATION ON TEL: 0898408331 OR COPY
THIS LINKS: http://www.youtube.com/watch?v=k14WAzpANJc 
http://groups.google.com/group/propertybg
--
http://mail.python.org/mailman/listinfo/python-list


plot for sale

2008-11-07 Thread [EMAIL PROTECTED]
SELL OUT land area with 12,681 ha, located at the entrance to the town
of Pazardzhik(Bulgaria) in  city limits and has 106 meters
individual . Dimcho Debelyanov (Miryansko road). A plot in the new
economic zone of the city - in the vicinity has built industrial
enterprises, shops and warehouses. Until the plot has built any
communications - trafopost, water supply, sewerage, telephone lines,
street lights, bus stop . MORE INFORMATION ON TEL: 0898408331 OR COPY
THIS LINKS: http://www.youtube.com/watch?v=k14WAzpANJc 
http://groups.google.com/group/propertybg
--
http://mail.python.org/mailman/listinfo/python-list


Re: Step-by-step exec

2008-11-06 Thread [EMAIL PROTECTED]
On Nov 6, 4:27 pm, [EMAIL PROTECTED] wrote:
 Hi,

 I am using a small python file as an input file (defining constants,
 parameters, input data, ...) for a python application.
 The input file is simply read by an exec statement in a specific
 dictionary, and then the application retrieve all the data it need
 from the dictionary...
 Everything is working nicely, but I'd like to have something a little
 bit more robust regarding input file errors: now
 any error in the python input script raise an exception and stop the
 execution.
 What I am trying to do is to execute it step-by-step, so that I can
 capture the exception if one line (or multi-line statement) fails,
 print a warning about the failure, and continue the execution fo the
 following lines/statements. Of course, an error on one line can
 trigger errors in the following lines, but it does not matter in the
 application I have in mind, the goal is to parse as much of the input
 script as possible, warn about the errors, and check what's inside the
 dictionary after the exec.
 One way to do it is to read the input script line per line, and exec
 each line in turn. However, this is not convenient as it does not
 allow multi-line statements, or basic control flow like if - else
 statements or loops.

Do you have control over the input file generation ? If the input file
can be easily divided into self sufficient blocks of code, you could
read each block in one at a time and do a compile() and exec(). Your
input file need not be a full python script too, you could just have
token delimited blocks of python code which are read in 1 block at a
time and then exec().

-srp


 Is there a better way for a step-by-step exec? Syntax errors in the
 input script are not really a problem (as it is generated elsewhere,
 it is not directly edited by users), although it would be nice to
 catch. The biggest problem are runtime errors (attribute error, value
 error, ...). Maybe compiling the file into a code object, and
 executing this code object step-by-step in a way similar to debug? pdb
 module should do something similar

 Best regards,

 Greg.

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


Re: subprocess and PPID

2008-11-06 Thread [EMAIL PROTECTED]
On Nov 6, 3:09 pm, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
 In message [EMAIL PROTECTED], Michele Petrazzo wrote:

  Lawrence D'Oliveiro wrote:

  See the prctl(2) man page.

  Just seen. It can be, bust since I cannot modify the child process and
  this syscall must be called from the child, I cannot use it.

 You do the fork and then the exec, right? So do the prctl in-between.

You could also write a wrapper program that does a prctl and then
exec(actual command). Infact you could use a wrapper program to
portably poll for the parent if you dont want to prctl(); invoke this
wrapper from python, the wrapper can then invoke your actual command.

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


CGI Python problem

2008-11-06 Thread [EMAIL PROTECTED]
Hi all,

I'm trying to get python to work with cgi for a small intranet site,
however even a simply hello world test isn't working. Here is the
test file:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb; cgitb.enable()

print Content-Type: text/plain;charset=utf-8
print

print Hello World!

I've placed this file in both public_html and as a test in public_html/
cgi-bin directories in my local user account (I dont have root access
- its a corparate network). The file definitely has read and execute
permission (744) as have the assoicated directories. However when I
navigate to the file with my browser I get a 500 page?! The code was
written fully in linux, so its not some odd windows/linux line
termination issue.

As a test I tried a perl cgi hello world test, and this worked
correctly. The apache server appears to be locked down tightly, as
allowOverwrite is None, so I can't do anything in .htaccess files.

Any thoughts on how I might debug this or where the problem is
--
http://mail.python.org/mailman/listinfo/python-list


Re: Weird behavior with lexical scope

2008-11-06 Thread [EMAIL PROTECTED]
On Nov 6, 9:57 pm, mrstevegross [EMAIL PROTECTED] wrote:
 I ran into a weird behavior with lexical scope in Python. I'm hoping
 someone on this forum can explain it to me.

 Here's the situation: I have an Outer class. In the Outer class, I
 define a nested class 'Inner' with a simple constructor. Outer's
 constructor creates an instance of Inner. The code looks like this:

 =
 class Outer:
   class Inner:
     def __init__(self):
       pass
   def __init__ (self):
     a = Inner()
 Outer()
 =

 However, the above code doesn't work. The creation of Inner() fails.
 The error message looks like this:

   File /tmp/foo.py, line 12, in module
     Outer()
   File /tmp/foo.py, line 10, in __init__
     a = Inner()
 NameError: global name 'Inner' is not defined

 This surprises me! Since the construction of Inner takes place within
 the lexical scope 'Outer', I assumed the interpreter would search the
 Outer scope and find the 'Inner' symbol. But it doesn't! If I change:
   a = Inner()
 to
   a = Outer.Inner()

 it works fine, though.

AFAIK, when 'Outer.__init__' executes, 'Inner' is first searched for
within 'Outer.__init__()'s local namespace. Since 'Inner' is defined
outside the function namespace, the search will fail. Python then
looks at the module level namespace - where Inner is again not defined
(only 'Outer' is available in the module namespace), the final search
will be in the interpreter global namespace which will fail too. When
you change your code from 'Inner' to 'Outer.Inner', the module level
namespace search will match ( or atleast that's how i think it should
all work :) )

Try this ..

class Outer:
   def __init__(self):
  class Inner:
 def __init__(self): pass
  a = Inner()
Outer()

This should work, because the Outer.__init__ namespace (first
namespace being searched) has Inner defined within it

-srp




 So, can anyone explain to me how Python looks up symbols? It doesn't
 seem to be searching the scopes I expected...

 Thanks,
 --Steve

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


Re: Can read() be non-blocking?

2008-11-06 Thread [EMAIL PROTECTED]
On Nov 7, 9:09 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
 In message [EMAIL PROTECTED], Lawrence D'Oliveiro wrote:

  In message [EMAIL PROTECTED], Thomas
  Christensen wrote:

        r = select.select([proc.stdout.fileno()], [], [], 5)[0]
        if r:
            # NOTE: This will block since it reads until EOF
            data = proc.stdout.read()

  No, it will read what data is available.

 Sorry, maybe not. But you can set O_NOBLOCK on the fd.

Set O_NONBLOCK on proc.fileno() and try using os.read() on that
descriptor.

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


Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-05 Thread [EMAIL PROTECTED]
On Nov 5, 12:29 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
 On Tue, 04 Nov 2008 21:58:17 -0500, [EMAIL PROTECTED] declaimed
 the following in comp.lang.python:


  Python depends upon Sqlite... which is weird... but it is what I 
  discovered...

         Not really (weird). Python, as of 2.5, includes the PySQLite DB-API
 adapter as part of the native library/source code. BUT SQLite is NOT
 part of Python (the Windows installers typically include the SQLite
 engine as a convenience, but Linux installers expect the engine to
 already be available).


To clarify further. sqlite is supported in python by providing python
language bindings over the sqlite *native* apis. SQLite is written in
C; pysqlite uses the SQLite C api and intelligently glues it into the
python interpreter and makes python language apis available to you.
This is why Python (pysqlite2 rather) depends on the native SQLite
libraries

This is usually how any new functionality would be made available in
python - by writing python wrappers over the existing native
libraries. The other method would be to re-implement the complete
functionality in pure python (an eg of this technique would be
paramiko which implements SSH2 in pure python)

-srp

         None of the other database adapters are part of the base library.
 --
         Wulfraed        Dennis Lee Bieber               KD6MOG
         [EMAIL PROTECTED]             [EMAIL PROTECTED]
                 HTTP://wlfraed.home.netcom.com/
         (Bestiaria Support Staff:               [EMAIL PROTECTED])
                 HTTP://www.bestiaria.com/

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


Re: Raw socket when interface down.

2008-11-05 Thread [EMAIL PROTECTED]
On Nov 5, 8:37 pm, Mat [EMAIL PROTECTED] wrote:
 Hi,

 I'm trying to use raw sockets in python for a dhcp client. I write this code :

 soc = socket.socket(socket.PF_PACKET, socket.SOCK_RAW)
 soc.bind((eth0,0x0800))
 data = soc.recv(1024)
 print len(data)

 It seems to work correctly when interface is up, but when network interface is
 down I get this message :
 socket.error: (100, 'Network is down')

 I look over a lot of C code of dhcp clients. But I didn't find something 
 useful.
 I don't how to access the network when interface is down with python. Can
 someone helps

mmm, if the interface is down the n/w subsystem will not send messages
out and if possible also disables reception of messages via that
interface. In your case it is likely that the interface message
reception is also disabled. You need to bring up the interface
(ifconfig eth0 up) before you can read/write any data on that
interface.

-srp

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


Re: subprocess and PPID

2008-11-05 Thread [EMAIL PROTECTED]
On Nov 5, 5:12 pm, Michele Petrazzo [EMAIL PROTECTED]
wrote:
 Hi all,
 I believe that this is a *nix question, but since I'm developing in
 python, I'm here.

 I have a code that execute into a Popen a command (ssh). I need that,
 if the python process die, the parent pid (PPID) of the child don't
 become 1 (like I can seen on /proc/$pid$/status ), but it has to die,
 following it's parent
 It's possible in linux and with subprocess?


AFAIK, there is no easy way to do this. If the parent python process
is doing a controlled exit, just kill the child via close() on Popen()
handle. If the parent is doing a uncontrolled exit (say via a SIGKILL
signal), you can't really do anything.

To reliably have the child exit when the parent exits, you would have
to poll for the parent from the child and do a exit when the child
detects that the parent has gone away.

-srp


 Thanks,
 Michele

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


Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-05 Thread [EMAIL PROTECTED]
On Nov 5, 9:22 pm, Shawn Milochik [EMAIL PROTECTED] wrote:
 This is all useful and interesting stuff, but I don't think any of it
 addresses the original poster's problem, which is that he has no root
 access to a Linux or Unix box, and wants to get pysqlite2 working in
 his home directory. I have exactly the same problem. I have tried the
 python setup.py install --home=~ method, and I get errors from GCC
 that I have no permissions (and to be honest, nor the knowledge) to
 overcome.

 Isn't there anyway to get a Linux binary that can just be put
 somewhere in the Python path so we can use sqlite? Or are those of us
 without admin/root control of our boxes screwed?

1. Get sqlite3 from http://www.sqlite.org/sqlite-3.6.4.tar.gz
2. build and install sqlite3 (./configure --prefix=/any/writeable/dir
 make install) -- you may want to supply the --disable-tcl flag if
you hit permission problems
3. get pysqlite3, edit setup.cfg libraries and include lines to point
to the lib/ and include/ dir where you installed sqlite3 in the
previous step
4. python setup.py install --home=somewhere
5. PYTHONPATH=somewhere ./python -- import pysqlite2 should work for
you
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-05 Thread [EMAIL PROTECTED]
On Nov 5, 10:07 pm, Shawn Milochik [EMAIL PROTECTED] wrote:
 On Wed, Nov 5, 2008 at 11:58 AM, [EMAIL PROTECTED]



 [EMAIL PROTECTED] wrote:
  On Nov 5, 9:22 pm, Shawn Milochik [EMAIL PROTECTED] wrote:
  This is all useful and interesting stuff, but I don't think any of it
  addresses the original poster's problem, which is that he has no root
  access to a Linux or Unix box, and wants to get pysqlite2 working in
  his home directory. I have exactly the same problem. I have tried the
  python setup.py install --home=~ method, and I get errors from GCC
  that I have no permissions (and to be honest, nor the knowledge) to
  overcome.

  Isn't there anyway to get a Linux binary that can just be put
  somewhere in the Python path so we can use sqlite? Or are those of us
  without admin/root control of our boxes screwed?

  1. Get sqlite3 fromhttp://www.sqlite.org/sqlite-3.6.4.tar.gz
  2. build and install sqlite3 (./configure --prefix=/any/writeable/dir
   make install) -- you may want to supply the --disable-tcl flag if
  you hit permission problems
  3. get pysqlite3, edit setup.cfg libraries and include lines to point
  to the lib/ and include/ dir where you installed sqlite3 in the
  previous step
  4. python setup.py install --home=somewhere
  5. PYTHONPATH=somewhere ./python -- import pysqlite2 should work for
  you
  --

 Thanks, but either I'm missing something or you're missing something.
 I can't do any of what you describe on the machine I want to use
 sqlite on.

 I have downloaded the binary sqlite3 file from sqlite's Web site, and

The linux binary will not work. You need the headers and the
libraries. Grab the src tar ball and build and install locally.

-srp

 I can use it with shell scripts and via the command line with no
 problem. The issue is that I don't seem to have any way available to
 me to use the pysqlite2 Python module.

 When I try the python setup.py --install --home=somewhere
 installation, it blows up on GCC errors that I do not have the
 permissions to even attempt to fix.  What I was asking above was
 whether there was a way do download the pysqlite2 module as files that
 I can just copy into a directory that Python thinks is part of its
 path so I can use it without having to compile or build it in any way
 on that machine.

 Thanks,
 Shawn

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


Trying to set a date field in a access databse

2008-11-05 Thread [EMAIL PROTECTED]
Hi,
I cannot get the following code to work

import win32com.client
import time

engine = win32com.client.Dispatch(DAO.DBEngine.36)
db=engine.OpenDatabase(rtestdate2.mdb)
access = db.OpenRecordset(select * from test)

access.AddNew()
access.Fields(test).value=time.strptime('10:00AM', '%I:%M%p')
access.Update()

wherer test is a datetime field,
How can I do this???
-Ted

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


Re: Sending multi-part MIME package via HTTP-POST

2008-11-04 Thread [EMAIL PROTECTED]
Sadly, there is no way to increase the log verbosity.

On Oct 17, 2:42 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
 In message
 [EMAIL PROTECTED],



 [EMAIL PROTECTED] wrote:
  On Oct 15, 2:42 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
  central.gen.new_zealand wrote:

  In message
  [EMAIL PROTECTED],

  [EMAIL PROTECTED] wrote:
   ... but I'm getting a very vague server error message ...

  Which is?

  In this case it's not really something that will be readily recognized
  here, nor is it extremely helpful diagnostic-wise. This is the only
  debug output I can get from the logs or stdout:

  Failed to parse content as JDF.

 I may not recognize it, but I can Google:
 http://www.cip4.org/overview/what_is_jdf.html.

 Does the server log contain any more information? If not, is it possible to
 increase the log verbosity level in the server?

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


Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-04 Thread [EMAIL PROTECTED]
On Nov 5, 6:47 am, Kurda Yon [EMAIL PROTECTED] wrote:
 Hi,

 I try to build and install pysqlite? After I type python setup.py
 build I get a lot of error messages? The first error  is src/
 connection.h:33:21: error: sqlite3.h: No such file or directory. So,
 I assume that the absence of the sqlite3.h is the origin of the
 problem.


You can try downloading sqlite3 from the web and installing it in a
local dir. Update pysqlite setup.cfg to add these local dir names and
then try building it.

-srp


 I found on the web, that this file should be either in /usr/local/
 include or in /usr/local/lib. I check this directories and I really
 do not have the sqlite3.h there.

 Thinks becomes even more complicated since I have no permissions to
 write to the 2 above mentioned directories? So, do I have any chance
 to install the pysqlite? If yes, what should I do?

 Should I find the file on the web and put in in some of my directories
 and then to change the path in the setup.cfg?

 Thank you for any help.

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


Re: Problem using urllib to download images

2008-11-03 Thread [EMAIL PROTECTED]
On Nov 3, 11:48 am, [EMAIL PROTECTED] wrote:
 I am using Python 2.6 on Mac OS 10.3.9.
 I have been trying to use:
 image = urllib.URLopener()
 image.retrieve(url, filename)
 to download images from websites. I am able to do so, and end up with
 the appropriate file. However, when I try to open the file, I get an
 error message. It's something about corrupted data, and an
 unrecognised file.
 Anyone know what I'm talking about/had similar experiences?
 -Taidgh

Please show an actual program, complete with error messages.

import urllib
image = urllib.URLopener()
image.retrieve(http://www.python.org/images/success/nasa.jpg;,
NASA.jpg)


Works for me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: redirection in a file with os.system

2008-11-03 Thread [EMAIL PROTECTED]
On Nov 4, 12:06 am, TP [EMAIL PROTECTED] wrote:
 Hi everybody,

 The following code does not redirect the output of os.system(ls) in a
 file:

 import sys, os
 saveout = sys.stdout
 fd = open( 'toto', 'w' )
 sys.stdout = fd
 os.system( ls )
 sys.stdout = saveout
 fd.close()

os.system() will call the libc system() which should fork() and exec()
the '/bin/sh' shell with your command. The shell will inherit python's
file descriptors. sys.stdout is a python level object, not a process
level descriptor. By swapping sys.stdout with another file object you
have only changed a python level file object. In the second snippet
you have correctly updated the underlying process level descriptors.

I imagine a print statement just after the sys.stdout = fd will
not go to your stdout but the 'toto' file.

-srp




 Whereas the following works:

 old_stdout = os.dup( sys.stdout.fileno() )
 fd = os.open( 'bar', os.O_CREAT | os.O_WRONLY )
 os.dup2( fd, sys.stdout.fileno() )
 os.system( ls )
 os.close( fd )
 os.dup2( old_stdout, sys.stdout.fileno() )

 Why?

 I have another question: with this last code using os.open, the problem is
 that the file 'bar' is not removed before being written. So, it could lead
 to errors: the file 'bar' is overwritten, but extra lines from previous
 executions could remain.
 Am I compelled to use os.unlink (or os.remove) before calling
 os.system(ls)?

 Thanks

 Julien

 --
 python -c print ''.join([chr(154 - ord(c)) for c in '*9(9(18%.91+,\'Z
 (55l4('])

 When a distinguished but elderly scientist states that something is
 possible, he is almost certainly right. When he states that something is
 impossible, he is very probably wrong. (first law of AC Clarke)

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


storing a string data in access

2008-11-02 Thread [EMAIL PROTECTED]
Hi
I have
access.Fields(Time).value=t
I would like t to be  a string reprsenting a data.  How can I do this?
--
http://mail.python.org/mailman/listinfo/python-list


Dont miss... Just click...

2008-11-02 Thread [EMAIL PROTECTED]
http://www.sportstips8.blogspot.com/
--
http://mail.python.org/mailman/listinfo/python-list


Shah Rukh kicks off Temptations Reloaded with style

2008-11-01 Thread [EMAIL PROTECTED]
Shah Rukh kicks off Temptations Reloaded with style


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


Re: open a shell prompt froma python program

2008-10-30 Thread [EMAIL PROTECTED]
On Oct 30, 11:53 am, gaurav kashyap [EMAIL PROTECTED] wrote:
 HI,
 I am getting the following error:

 konsole: cannot connect to X server

 do i need to install the related files.

Do you have an x-server running? I assume so, because you have a
terminal window opened.

If you became root using su, you need to allow connections to x-
server, which is started by the regular user. you can do this for
local access using
$ xhost local:

Best wishes! Bernhard
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python memory usage

2008-10-29 Thread [EMAIL PROTECTED]
On Oct 21, 5:19 pm, Rolf Wester [EMAIL PROTECTED] wrote:
 Hi,

 I have the problem that with long running Python scripts (many loops)
 memory consumption increases until the script crashes. I used the
 following small script to understand what might happen:

snip

AFAIK, python uses malloc behind the scenes to allocate memory. From
the malloc man page...

The  malloc() and free() functions provide a simple, general-purpose
memory allocation package. The malloc() function returns a pointer to
a block of at least size bytes suitably aligned for any use. If the
space assigned by malloc() is overrun, the results are undefined.

The argument to free() is a pointer to a block previously allocated by
malloc(), calloc(), or realloc(). After free() is executed, this space
is made available for further  allocation by the application, though
not returned to the system. Memory is returned to the system only
upon  termination of  the  application.  If ptr is a null pointer, no
action occurs. If a random number is passed to free(), the results are
undefined.

HTH,

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


Re: free IDE with removing import and refactoring

2008-10-29 Thread [EMAIL PROTECTED]
HI!
Did you tried the ERIC python IDE?

Rew

pihentagy írta:
 Hi!

 I am looking for a python IDE which can remove my unused imports, and
 can do basic refactoring under windows.

 Can somebody advice me such an IDE?

 I have played with eclipse and netbeans, but I cannot find such a
 functionality (but maybe I looked it over).

 Besides, an installation howto would be useful for me.

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


Fastest way to convert sql result into a dict or list ?

2008-10-29 Thread [EMAIL PROTECTED]
Hello,

I'm trying to find the fastest way to convert an sql result into a
dict or list.
What i mean, for example:
my sql result:
contact_id, field_id, field_name, value
sql_result=[[1, 1, 'address', 'something street'],
 [1, 2, 'telnumber', '11'],
 [1, 3, 'email', '[EMAIL PROTECTED]'],
 [2, 1, 'address','something stree'],
 [2, 3, 'email','[EMAIL PROTECTED]']]
the dict can be:
dict={1:['something street', '11' ,
'[EMAIL PROTECTED]'],
2:['something street', '', '[EMAIL PROTECTED]' ]}
or a list can be:
list=[[1,'something street', '11' ,
'[EMAIL PROTECTED]'],
   [2,'something street', '', '[EMAIL PROTECTED]' ]]

I tried to make a dict, but i think it is slower then make a list, and
i tried the one lined for to make a list, it's look like little bit
faster than make a dict.

def empty_list_make(sql_result):
return [ [line[0],, , ]   for line in sql_result]

than fill in the list with another for loop.
I hope there is an easyest way to do something like this ??
any idea ?
--
http://mail.python.org/mailman/listinfo/python-list


Re: guenstige kredite

2008-10-29 Thread [EMAIL PROTECTED]
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
http://www.officeformac.com/ProductForums/WindowsMediaPlayerMac/275 -
kredit ohne schufa ohne kredit ohne schufa ohne vorkosten
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.5.chm problem

2008-10-27 Thread [EMAIL PROTECTED]

This solve the problem:
http://techrepublic.com.com/5208-11183-0.html?forumID=89threadID=191474

regsvr32 %systemroot%\system32\hhctrl.ocx press enter
regsvr32 %systemroot%\system32\itss.dll press enter


[EMAIL PROTECTED]:

Hi!

When I try to open the 2.5 Python help, I got error message:
  A fájl (mk:@MSITStore:c:\Python25\Doc\Python25.chm) nem nyitható meg.

The english translation is this:
  Cannot open the file (mk:@MSITStore:c:\Python25\Doc\Python25.chm)

I not experienced this problem in the Python 2.4 the help.

What is the solution for this problem? I don't wanna use web helps.

Thanks for it:
dd

--




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


Re: Improving interpreter startup speed

2008-10-27 Thread [EMAIL PROTECTED]

To make faster python, you can do:

1.) Use mod_python, and not cgi.
2.) Use other special python server that remaining in memory, and call 
it from compiled C code. For example, the C code communicate this server 
with pipes, tcp, (or with special files, and the result will come back 
in other file).
You can improve this server when you split threads to python 
subprocesses, and they still alive for X minutes.
You have one control process (py), and this (like the apache) 
communicate the subprocesses, kill them after timeout, and start a new 
if needed.


dd

James Mills írta:

On Mon, Oct 27, 2008 at 5:46 PM, Gabriel Genellina
[EMAIL PROTECTED] wrote:

+1 This thread is stupid and pointless.
Even for a so-called cold startup 0.5s is fast enough!

I don't see the need to be rude.
And I DO care for Python startup time and memory footprint, and others do
too. Even if it's a stupid thing (for you).


I apologize. I do not see the point comparing Python with
RUby however, or Python with anything else.

So instead of coming up with arbitary problems, why don't
we come up with solutions for Improving Interpreter Startup Speeds ?

I have only found that using the -S option speeds it up
significantly, but that's only if you're not using any site
packages and only using the built in libraries.

Can site.py be improved ?

--JamesMills



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


Re: using modules in destructors

2008-10-25 Thread [EMAIL PROTECTED]
It seems to me that deleting local instances before imported modules
would solve the problem. Is it not possible for the interpreter to get
this right? Or are there cases where this would break stuff.

It seems rather unpythonic for the __del__() method to become
unpredictable at exit.
--
http://mail.python.org/mailman/listinfo/python-list


using modules in destructors

2008-10-24 Thread [EMAIL PROTECTED]
Hi

i have i have a class that makes temp folders to do work in. it keeps
track of them, so that in the __del__() it can clean them up. ideally
if the user of the module still has objects left at the end of their
program, they should be automatically cleaned up. in my destructor i
had a call to shutil.rmtree (which had been imported at the start of
more module), however when the destructor is called shutil has been
set to None.

i have made a minimal case to reproduce

#!/usr/bin/env python
import shutil
from math import *

class Foo(object):
def __init__(self):
print shutil
def __del__(self):
print shutil

if __name__ == '__main__':
print shutil
a = Foo()

this outputs
module 'shutil' from '/usr/lib/python2.5/shutil.pyc'
module 'shutil' from '/usr/lib/python2.5/shutil.pyc'
None

the odd thing is that if i remove the line from math import * then i
get the output
module 'shutil' from '/usr/lib/python2.5/shutil.pyc'
module 'shutil' from '/usr/lib/python2.5/shutil.pyc'
module 'shutil' from '/usr/lib/python2.5/shutil.pyc'

This seems inconsistent, and makes me wonder if it is a bug in the
interpreter.

As an ugly work around i have found that i can keep a reference to
shutil in the class.

class Foo(object):
def __init__(self):
self.shutil = shutil
print self.shutil
def __del__(self):
print shutil
print self.shutil

But given the difference an import statement can make, i am not sure
this is robust.

I have been working with Python 2.5.2 (r252:60911, Oct  5 2008,
19:24:49) from ubuntu intrepid.

(if google groups does bad things to the code formating, please see
http://ubuntuforums.org/showthread.php?p=6024623 )

Thanks

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


Re: Snapshot+Clipboard

2008-10-23 Thread [EMAIL PROTECTED]



Claudio Grondi wrote:
 
 Yves Lange wrote:
 Hello,
 i'm searching a method to take a snapshot and save it in a jpg, bmp or 
 gif file. I tried with win32api and win32con but it save the snapshot to 
 the clipboard, so i tried to redirect this in a file but i have some 
 problems while getting the IMAGE stocked in the clipboard and save it to 
 a file. Can somebody help me ?
 
 Questions:
 -How can i read the snapshot in the clipboard ?
 -How can i take a snapshot in a different way (less difficult) ?
 
 Thks.
 
 Use PIL which on Windows supports taking snapshots of the screen.
 code
 import ImageGrab
 GrabbedImage = ImageGrab.grab() # store screenshot as RGB Image
 GrabbedImage.save(TheScreenshot.jpg) # PIL evaluates extension
 /code
 For more details see:
http://effbot.org/imagingbook/imagegrab.htm
 (works on Windows only)
 
 Claudio Grondi
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
 

In my project I need a module to do the ImageGrab's job but in linux,
so is there a linux version module by now or do you know the other module
fit for linux?

if anybody knows that, please reply me, thanks.

-- 
View this message in context: 
http://www.nabble.com/Snapshot%2BClipboard-tp5400375p20127327.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: Append a new value to dict

2008-10-23 Thread [EMAIL PROTECTED]



Frank Niemeyer wrote:
 
 However incrementing a non-existing key throws an exception.
 
 Right. And that's exactly what I would expect, according to the
 principle of least surprise Python tries to obey. There's simply no
 way to increment a non-existent value - not without performing some
 obscure implict behind-the-scenes stuff.
 
 So you 
 either have to use a workaround:
 
   try:
 ...   counter['B'] += 1
 ... except KeyError:
 ...   counter['B'] = 1
 
 Or you could simply use
 
 if counter.has_key('B'):
 counter['B'] += 1
 else:
 counter['B'] = 1
 
 Regards,
 Frank
 --
 http://mail.python.org/mailman/listinfo/python-list
 
 

or 

if 'B' in counter:
counter['B'] += 1
else:
ocunter['B'] = 1
-- 
View this message in context: 
http://www.nabble.com/Append-a-new-value-to-dict-tp19953085p20127415.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: Module for creating a screenshot of a web page given a URL?

2008-10-23 Thread [EMAIL PROTECTED]



John J. Lee wrote:
 
 [EMAIL PROTECTED] writes:
 
  Untestetd, but I'm pretty sure something like this will do.
  If you need more control, and on windows, try pywinauto
 
 I do need it to run on Windows. I'll check out pywinauto. Thanks.
 
 Note he didn't say you *need* pywinauto to run on Windows.
 
 
 John
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
 

Is there anyway to do the same job in linux? 
The ImageGrab doesn't support for linux system.

If anyone knows that, please, reply me. Thanks a lot.
-- 
View this message in context: 
http://www.nabble.com/Module-for-creating-a-screenshot-of-a-web-page-given-a-URL--tp5188873p20127934.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


How to get the time of message Received of an outlook mail in python..

2008-10-23 Thread [EMAIL PROTECTED]
Hi,,
  How can we access the time of message received ( UTC time) of an
outlook mail in python? As far as I know the time which it displays in
the mail is not the exact time... this UTC time will be present in
MIME Header of an outlook mail.

Any Help is appreciated..and thanks in advance,,
Venu.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to get the time of message Received of an outlook mail in python..

2008-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 4:01 pm, Tzury Bar Yochay [EMAIL PROTECTED] wrote:
 On Oct 23, 12:04 pm, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  Hi,,
        How can we access the time of message received ( UTC time) of an
  outlook mail in python? As far as I know the time which it displays in
  the mail is not the exact time... this UTC time will be present in
  MIME Header of an outlook mail.

  Any Help is appreciated..and thanks in advance,,
  Venu.

 You may google for how to utilize outlook using OLE-COM automation
 When finding out how, implement it using python's com wrappers

Thanks for your suggestion.. but I couldn't get the actual parameter
for getting the time of a mail
received... could get other features of a mail like the subject of a
mail, its content and senders n receivers address :-)

Venu.


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


Python Script Bug

2008-10-23 Thread [EMAIL PROTECTED]
Hello everyone,
I would like to know what isn't good in my script.
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
from time import strftime
import datetime
t = input(datetime.date)
global t
print t.strftime(Day %w of the week a %A . Day %d of the month (%B).
)
print t.strftime(Day %j of the year (%Y), in week %W of the year.)
raw_input()
i get error :
print t.strftime(Day %w of the week a %A . Day %d of the month
(%B). )
AttributeError: 'tuple' object has no attribute 'strftime'
Thanks for your Help
--
http://mail.python.org/mailman/listinfo/python-list


Re: why would 'import win32com' fail?

2008-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 3:21 pm, bill [EMAIL PROTECTED] wrote:
 All,

 I am trying to access Excel from Python. Many of the examples started
 with:

       import win32com
       
       blah, blah

 I try that from my Python shell and it fails. What am I missing here?

You need to download and install the Python Extensions for Windows.

http://sourceforge.net/project/showfiles.php?group_id=78018
--
http://mail.python.org/mailman/listinfo/python-list


Python 2.5.chm problem

2008-10-22 Thread [EMAIL PROTECTED]

Hi!

When I try to open the 2.5 Python help, I got error message:
  A fájl (mk:@MSITStore:c:\Python25\Doc\Python25.chm) nem nyitható meg.

The english translation is this:
  Cannot open the file (mk:@MSITStore:c:\Python25\Doc\Python25.chm)

I not experienced this problem in the Python 2.4 the help.

What is the solution for this problem? I don't wanna use web helps.

Thanks for it:
dd

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


execve error with the subprocess module

2008-10-21 Thread [EMAIL PROTECTED]
I have some code which runs on a number of different machines, however
I see problems on one particular Solaris box.  When I call
Popen.wait(), the following exception is raised:

. . .
File /basis/users/matt/Python-2.4.4/Lib/subprocess.py, line 558, in
__init__
errread, errwrite)
  File /basis/users/matt/Python-2.4.4/Lib/subprocess.py, line 992,
in _execute_child
raise child_exception
TypeError: execve() arg 3 contains a non-string value

I've been poking around a bit subprocess.py and I can't figure out why
data is non-empty string in this line:
 data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB)

From what I see, the command I'm running is perfectly valid and should
be running without any problems.

Any help is appreciated.
--
http://mail.python.org/mailman/listinfo/python-list


Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread [EMAIL PROTECTED]
On Oct 19, 8:35 am, Stef Mientki [EMAIL PROTECTED] wrote:
 I (again) wonder what's the perfect way to store, OS-independent,
 filepaths ?

I don't think there is any such thing.  What problem are you trying to
solve?
--
http://mail.python.org/mailman/listinfo/python-list


Big money in a simple program!!!

2008-10-19 Thread [EMAIL PROTECTED]
IT'S SIMPLE AND IT'S LEGAL!!!
Who doesn’t want to make tons of money ridiculously easy? Read this
letter follow the instructions, and like me you’ll never have to worry
about
money again.
I was browsing through news groups just like you are right now and
Came across a article similar to this saying that you could make
thousands
Of dollars within weeks with only an initial investment of $12.00!! So
I
Thought yeah right. This must be a scam, but like most of us, I was
Curious, so I kept reading. Anyway it said that you send two dollars
to
Each of the six names and addresses stated in the article. You then
place
Your own name and address on the bottom of the list at number six and
post
The article to at least 200 newsgroups. (there are thousands) No
catch
That was it. So after talking to a few people and thinking it over I
Decided to give it a try. What have I got to lose except 6 stamps and
$12.00 right? Then I invested the measly twelve dollars. WELL GUESS
WHAT!!!
Within 7 days, I started getting money in the mail!!! I was shocked.
I
Thought it was going to stop but it just kept coming. In my first week
I
Made $50.00. By the end of the second week I had $1,800.00. In the end
of
The third week I made $10,000.00!!! It's still growing right now. This
is
Now my fourth week and I have made a total of just over $76,000.00!
and
It's still coming in rapidly. This is certainly worth $12.00 and 6
stamps.
I have spent more than that on the lottery!!
Let me tell you how this works and most importantly why it works.
Also
Make sure that you print a copy of this article NOW so you can get
the
Information off of it as you need it. I promise you that if you follow
the
Directions exactly, that you will start making more money than you
Possibly thought just by doing something so easy!! SUGGESTION: READ
THIS
ENTIRE MESSAGE CAREFULLY (Print it out or down load it) Follow the
simple
Directions and watch the money come in! It's easy. It's legal. And
your
Investment is only $12.00 (plus postage) IMPORTANT: This is not a rip
off;
It is not indecent; it is not illegal; and it is virtually no risk -
it
Really works! If all of the following instructions are adhered to,
you
Will receive extraordinary dividends. PLEASE NOTE: please follow
these
Directions exactly and $100,000 or more can be yours in 20 to 60
days.
This program remains successful because of the honesty and integrity
of
The participants. Please continue its success by carefully adhering to
the
Instructions. You will now become a part of the mail order business.
In
This business your product is not solid and tangible, it's a service.
You
Are in the business of developing a mailing list. Many large
corporations
Are happy to pay big bucks for quality list. However, the money made
from
The mailing list is secondary to the income, which is made from
people
Like you and me asking to be included to that list. Here are the four
Steps to success:
STEP 1: Get 6 separate pieces of paper write the following on each
piece
Of paper PLEASE PUT ME ON YOUR MAILING LIST.
Now get 12 us 1dollar bills and place TWO bills inside EACH of the
six
Pieces of paper so the bills will not be seen through the envelope to
Prevent thievery. Next place one paper in each of the 6 envelopes and
seal
Them.
MAKE SURE THERE ARE ENOUGH STAMPS ON YOUR ENVELOPES. You should now
Have 6
Sealed envelopes, each with a piece of paper stating the above phrase
your
Name and address and two $1.00 bill. What you are doing is creating a
Service. THIS IS ABSOLUTELY LEGAL! You are requesting a legitimate
service
And you are paying for it! Like most of us, I was a little skeptical
and a
Little worried about the legal aspects of it all. So I checked it out
with
The U.S. Post Office (1-800-725-2161) and they confirmed that it is
indeed
Legal! Mail the six envelopes to the following addresses:
 #1) Jia Ming
  2101 Cumberland Ave
  Apt 2105 West Lafayette IN 47906
___
 #2) Kimberly Williams
  11865 S.W. 91st. Ave. #49
  Tigard OR. 97223
___
 #3) Rahim Karim
  105 Hillpine Rd. Apt M-2
  Columbia SC 29212
___
 #4)Bruno Antonelli Jr.
  8621 Euclid-Chardon Rd.
  Kirtland, OH 44094
___
 #5) Carrie Bowers
  403 New St
  Fairport Harbor, OH 44077
___
  #6) Eric Anthony
  1258 1/2 Spaulding AVE.
  Los Angeles, CA 90019

STEP 2: Now take the #1 name off the list that you see above,
Move the other names up (6 becomes 5, 5 becomes 4, etc) and add YOUR
name
As number 6 on the list.
STEP 3: Change anything you need to but try to keep this article as
Original as possible. Now post your amended article to at least 200
news
Groups. ( I think there are 24,000 groups) All you need is 200, but
Remember, the more you post 

Re: PythonWin -- drwatson

2008-10-18 Thread [EMAIL PROTECTED]
On Oct 18, 4:31 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
 On Sat, 18 Oct 2008 15:00:03 GMT, Frank L. Thiel [EMAIL PROTECTED]
 declaimed the following in comp.lang.python:
  Thanks for your reply, Allan.  I am not sure what you mean by the
  Windows installer package -- a *.msi file?.  I cannot find a *.msi file
  at Sourceforge, which is where the pywin32-212.win32-py2.6.exe came
  from.  When I use the latter (I have uninstalled and reinstalled using
  this many times now!), I get no error entries in the Event Viewer.
  However, when I try to open PythonWin, the Event Viewer shows the
  following message:

         Do you have a version of python 2.6 installed? (I'm surprised the
 standalone win32 package for Python 2.6 is even available already).
 Granted, win32 is maintained as a separate package, but the ActiveState
 Python download (which includes it by default) is still only on Python
 2.5.2
 The standalone package has been available for months, since the Alpha
stage I believe. I don't believe it will install without an installed
Python 2.6.
 PythonWin 2.6 of Oct 2 2008 works for me.  XP Pro service pack 3.
[ActiveState is not really relevant to this discussion.]
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to get the recipients addresses of an outlook mail in python...

2008-10-16 Thread [EMAIL PROTECTED]
On Oct 16, 5:22 pm, Miki [EMAIL PROTECTED] wrote:
          Can some one help me in obtaining the set of recipients email
  addresses from an outlook mail? I tried various options like ...

 message[To]
 message[Cc]

 HTH,
 --
 Mikihttp://pythonwise.blogspot.com

Thanks for your reply... Sorry , it didn't work...


session = Dispatch(MAPI.session)
session.Logon('outlook')  # MAPI profile name
inbox = session.Inbox
message = inbox.Messages.Item(i + 1)
rec = message[To]
print rec

I did some thing like the above code...it said the below error...
 raise TypeError, This object does not support enumeration
TypeError: This object does not support enumeration


Thank you,
Venu.


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


how to get the recipients addresses of an outlook mail in python...

2008-10-16 Thread [EMAIL PROTECTED]
Hi all,
Can some one help me in obtaining the set of recipients email
addresses from an outlook mail? I tried various options like

   message.Recipient.Address
   message.To.Address
   message.Receiver.Address etc.. but I could get the senders address
using message.Sender.Address.


Thanks in advance,
Venu.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Sending multi-part MIME package via HTTP-POST

2008-10-15 Thread [EMAIL PROTECTED]
On Oct 15, 2:42 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
 In message
 [EMAIL PROTECTED],

 [EMAIL PROTECTED] wrote:
  ... but I'm getting a very vague server error message ...

 Which is?

In this case it's not really something that will be readily recognized
here, nor is it extremely helpful diagnostic-wise. This is the only
debug output I can get from the logs or stdout:

Failed to parse content as JDF.
--
http://mail.python.org/mailman/listinfo/python-list


VipIMAGE 2009 – ECCOMAS Thematic Conference - FIRS T ANNOUNCE

2008-10-15 Thread [EMAIL PROTECTED]
---

(Apologies for cross-posting)

International ECCOMAS Thematic Conference VipIMAGE 2009 - II ECCOMAS
THEMATIC
CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL IMAGE PROCESSING
21-23th October 2009, FEUP, Porto, Portugal
www.fe.up.pt/~vipimage

FIRST ANNOUNCE

We would appreciate if you could distribute this information by your
colleagues and co-workers.

---

Dear Colleague,

We are glad to announce the International Conference VipIMAGE 2009 -
II ECCOMAS THEMATIC CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL
IMAGE PROCESSING will be held in the Faculty of Engineering of
University of Porto, Porto, Portugal, on October 21-23, 2009.

Possible Topics (not limited to)

• Image Processing and Analysis
• Segmentation, Tracking and Analyze of Objects in Images
• 3D Vision
• Signal Processing
• Data Interpolation, Registration, Acquisition and Compression
• Objects Simulation
• Virtual Reality
• Software Development for Image Processing and Analysis
• Computer Aided Diagnosis, Surgery, Therapy and Treatment
• Computational Bioimaging and Visualization
• Telemedicine Systems and their Applications

Invited Lecturers

• Alejandro Frangi - Pompeu Fabra University, Spain
• Christos E. Constantinou - Stanford University School of Medicine,
USA
• Demetri Terzopoulos - University of California, USA
• Joaquim A. Jorge - Instituto Superior Técnico, Portugal
• José Carlos Príncipe - University of Florida, USA
• Lionel Moisan - Université Paris V, France
• Tony Chan - University of California, USA

Thematic Sessions

Proposals to organize Thematic Session within VipIMAGE 2009 are mostly
welcome.
The organizers of the selected thematic sessions will be included in
the conference scientific committee and will have a reduced
registration fee. They will be responsible for the dissemination of
their thematic session, may invite expertise researches to have
invited keynotes during their session and will participate in the
review process of the submitted contributions.
Proposals for Thematic Sessions should be submitted by email to the
conference co-chairs ([EMAIL PROTECTED], [EMAIL PROTECTED])

Publications

The proceedings book will be published by the Taylor  Francis Group,
as happened with VipIMAGE 2007 (ISBN: 9780415457774).
The organizers will encourage the submission of extended versions of
the accepted papers to related International Journals; in particular
for special issues dedicated to the conference.
One possibility already confirmed is the International Journal for
Computational Vision and Biomechanics (IJCVB).
As what happened with VipIMAGE 2007, the organizers will also propose
the publishing of a book by SPRINGER (ISBN: 978-1-4020-9085-1), under
the Computational Methods in Applied Sciences series, with invited
works from the most important ones presented in conference.

Important dates

• Deadline for Thematic Sessions proposals: January 15, 2009
• Submission of extended abstracts: March 15, 2009
• Lectures and Final Papers: June 15, 2009

We are looking forward to see you in Porto next year.

Kind regards,

João Manuel R. S. Tavares
Renato Natal Jorge
(conference co-chairs)

PS. For further details please see the conference website at:
www.fe.up.pt/~vipimage
--
http://mail.python.org/mailman/listinfo/python-list


writing emacs commands with your fav lang

2008-10-15 Thread [EMAIL PROTECTED]
Here's a little tutorial that lets you write emacs commands for
processing the current text selection in emacs in your favorite lang.

Elisp Wrapper For Perl Scripts
http://xahlee.org/emacs/elisp_perl_wrapper.html

plain text version follows.
-
Elisp Wrapper For Perl Scripts

Xah Lee, 2008-10

This page shows a example of writing a emacs lisp function that
process text on the current region, by calling a external perl script.
So that you can use your existing knowledge in a scripting language
for text processing as emacs commands.

THE PROBLEM

Elisp is great and powerful, but if you are new, it may take several
months for you to actually become productive in using it for text
processing. However, you are probably familiar with a existing
language, such as Perl, PHP, Python, Ruby. It would be great if you
can use your existing knowledge to write many text processing scripts,
and make them available in emacs as commands, so that you can just
select a section of text, press a key, then the selected text will be
transformed according to one of your script.

SOLUTION

Basically, all your elisp function has to do is to grab the current
region, then pass the text to a external program. The external program
will take the input thru Stdin↗, then produce the processed result in
Stdout. The elisp function will grab the text from the script's
Stdout, then replace the current region by that text. Lucky for us,
the elisp function shell-command-on-region already does this exactly.

For your script, its should takes input from Stdin and oput to Stdout.
For simplicity, let's assume your script is the unix program “wc”,
which takes input from Stdin and output a text to Stdout. (the “wc”
command counts the number of words, lines, chars in the text.) For
example, try this: “cat ‹file name› | wc”.

Here's the elisp wrapper:

(defun my-process-region (startPos endPos) Do some text processing on
region.  This command calls the external script “wc”.  (interactive
r) (let (scriptName) (setq scriptName /usr/bin/wc) ; full path to
your script (shell-command-on-region startPos endPos scriptName nil t
nil t) ))

You can assign a keyboard shortcut to it:

(global-set-key (kbd F6) 'my-process-region)

Put the above code in your “.emacs” then restart emacs. To use your
function, first select a region of text, then press the F6 key.

With the above, you can write many little text processing scripts in
your favorite language, and have them all available in emacs as
commands.

For how to define keyboard shortcuts with other keys, see: How to
Define Keyboard Shortcuts in Emacs.

  Xah
∑ http://xahlee.org/

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


Reading from stdin (in windows)

2008-10-14 Thread [EMAIL PROTECTED]

Hi!

I wanna write a file processor in python (Windows XP).
I wanna use pipe, and not parameters.

When I write this:

...
l = []
while 1:
t = sys.stdin.read(1)
if t == '':
break
l.append(t)

t = .join(l)
...

and use code this:
process.py test.txt

I got:
Bad file descriptor

What I do wrong? I need to call this module in another format?
Or I read in wrong way?

Thanks for your help:
   dd

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


Sending multi-part MIME package via HTTP-POST

2008-10-13 Thread [EMAIL PROTECTED]
This has got me somewhat stumped, so I'll throw it up here in hopes
that someone has ran into this before. I'm trying to send a MIME
package to Esko Backstage. I'm a bit confused as to how to send this
to the server in a manner that it'll be able to get and de-code the
MIME package in a valid way.

The big question is does this entire mime package belong in the
headers section of an HTTP request? If not, what is the best Pythonic
way to send this thing. I'm using 2.5's email package to create the
package and was trying to use its as_string() method to pump this
through httplib, but I'm getting a very vague server error message
that seems to indicate a malformed package. Here is the broken code:

hcon = httplib.HTTPConnection(JMF_GATEWAY)
hcon.putrequest('POST', JMF_GATEWAY_PATH)
hcon.endheaders()
hcon.send(msg.as_string())

I've pasted the string representation of the MIME package I'm trying
to send below. Any ideas would be greatly appreciated.

Content-Type: multipart/related;
boundary1845688244==
MIME-Version: 1.0
start: cid:beginning

--===1845688244==
Content-Type: application/vnd.cip4-jmf+xml
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: beginning

?xml version=1.0 ?JMF SenderID=QMon Version=1.2Command
ID=Link1290_5 Type=SubmitQueueEntryQueueSubmissionParams
Hold=false Priority=50 URL=cid:aJDF_1//Command/JMF
--===1845688244==
Content-Type: application/vnd.cip4-jdf+xml
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: aJDF_1

?xml version=1.0 ?
JDF DescriptiveName=StepRepeatTab and RIP ID=n0001
Status=Waiting Type=ProcessGroup Version=1.2 xmlns=http://
www.CIP4.org/JDFSchema_1_1 xmlns:eg=http://www.esko-graphics.com/
EGschema1_0
ResourcePool
RunList Class=Parameter DescriptiveName=1-up
ID=SourceFileList PartIDKeys=Run Status=Available
RunList Run=Run0001
LayoutElement
FileSpec URL=/archive/49297
PEPPINOS/49297-1 DMT-20.pdf/
/LayoutElement
/RunList
/RunList
/ResourcePool
JDF DescriptiveName=RIP1up ID=n0003 Status=Waiting
Type=eg:BackStageTask Version=1.2 xmlns=http://www.CIP4.org/
JDFSchema_1_1 xmlns:eg=http://www.esko-graphics.com/EGschema1_0;
NodeInfo JobPriority=50/
ResourcePool
eg:BackStageTaskParams Class=Parameter
ID=TaskParamLink Status=Available eg:Hold=false eg:TicketName=/
fripfile_s.file_sModel1.grx/XXXPROOFTICKETXXX/
/ResourcePool
ResourceLinkPool
eg:BackStageTaskParamsLink Usage=Input
rRef=TaskParamLink/
RunListLink Usage=Input
rRef=SourceFileList/
RunListLink Usage=Output rRef=TIFFList/
/ResourceLinkPool
/JDF
/JDF

--===1845688244==--

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


Re: how to start thread by group?

2008-10-13 Thread [EMAIL PROTECTED]
On Oct 13, 6:54 am, Lawrence D'Oliveiro [EMAIL PROTECTED]
central.gen.new_zealand wrote:
 In message [EMAIL PROTECTED], Gabriel



 Genellina wrote:
  En Tue, 07 Oct 2008 13:25:01 -0300, Terry Reedy [EMAIL PROTECTED]
  escribió:

  Lawrence D'Oliveiro wrote:

  In message [EMAIL PROTECTED],
  Gabriel Genellina wrote:

  Usually it's more efficient to create all the MAX_THREADS at once, and
  continuously feed them with tasks to be done.

   Given that the bottleneck is most likely to be the internet
  connection, I'd say the premature optimization is the root of all evil
  adage applies here.

  Feeding a fixed pool of worker threads with a Queue() is a standard
  design that is easy to understand and one the OP should learn.  Re-using
  tested code is certainly efficient of programmer time.

  I'd like to add that debugging a program that continuously creates and
  destroys threads is a real PITA.

 That's God trying to tell you to avoid threads altogether.

Especially in a case like this that's tailor made for a trivial state-
machine solution if you really want multiple connections.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Define a 2d Array?

2008-10-12 Thread [EMAIL PROTECTED]
On Oct 11, 9:30 pm, [EMAIL PROTECTED] wrote:
     Jill How do I define a 2d list?

 Python doesn't truly have 2d lists in the way you might think of 2d arrays
 in C or Fortran.  It has 1d lists which can contain any Python object,
 including other lists.  If you wanted to create a 4x5 list you'd do
 something like this:

     N = 4
     M = 5
     mylist = []
     for i in range(N):
         mylist.append([0.0] * M)

 If you are looking to do numeric work with such multidimensional lists you
 should consider the builtin array object or the numpy package:

    http://docs.python.org/dev/library/array.html#module-array
    http://numpy.scipy.org/

 Skip

I think you can do

mylist = [[]] or somesuch...

if you are looking on google for examples you will comonly find them
in spreadsheets..  I have one in the editor part of dex tracker
(available on source forge)  The array will start at zero and ie x[0]
and will keep growing as long as you .append it..  You don't define
the size in advance like you would with other languages..  You need to
have values befour you try to
use a location in the array.
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to set the time of a directory?

2008-10-11 Thread [EMAIL PROTECTED]
On Oct 11, 1:27 am, Timothy Grant [EMAIL PROTECTED] wrote:
 On Fri, Oct 10, 2008 at 10:16 PM, oyster [EMAIL PROTECTED] wrote:
  os.utime works only against files. so what to do for a directory?
  thanx

 Not sure why you'd say that.
I am. He's running Windows.


 drwxr-xr-x  2 tjg  tjg       68 Oct 10 22:23 test
 ([EMAIL PROTECTED]) python
 Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:16)
 [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
 Type help, copyright, credits or license for more information. 
 import os
  help(os.utime)

 Help on built-in function utime in module posix:

 utime(...)
     utime(path, (atime, mtime))
     utime(path, None)

     Set the access and modified time of the file to the given values.  If the
     second form is used, set the access and modified times to the current 
 time.

  os.utime('test', None)
  ^D

 ([EMAIL PROTECTED]) ls -ltr
 drwxr-xr-x  2 tjg  tjg       68 Oct 10 22:24 test

 --
 Stand Fast,
 tjg.  [Timothy Grant]


 os.utime('WinDir', None)
Traceback (most recent call last):
  File (stdin), line 1, in module
WindowsError: [Error 5] Access is denied: 'WinDir'



I consider this a bug. (Note that os.utime works for directories under
cygwin)


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


how to acess mplayer with slavemode in python?

2008-10-11 Thread [EMAIL PROTECTED]
how to acess mplayer with slavemode in python?
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   8   9   10   >