hii

2010-06-01 Thread madhuri vio
i wanted to know the difference between copy composed objects and
independent objects


composed objects

>>> firstserie = all_2_digests([’EcoRI’, ’HindIII’, ’BamHI’])

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> newserie = firstserie[1:]

>>> newserie

[[’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> newserie[1][0]=’SarI’

>>> newserie

[[’EcoRI’, ’BamHI’], [’SarI’, ’BamHI’]]

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’SarI’, ’BamHI’]]


independent objects

  >>> firstserie = all_2_digests([’EcoRI’, ’HindIII’, ’BamHI’])

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> import copy

>>> newserie = copy.deepcopy(firstserie)[1:]

>>> newserie

[[’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]

>>> newserie[1][0]=’SarI’

>>> newserie

[[’EcoRI’, ’BamHI’], [’SarI’, ’BamHI’]]

>>> firstserie

[[’EcoRI’, ’HindIII’], [’EcoRI’, ’BamHI’], [’HindIII’, ’BamHI’]]


i want to know the difference in the context of this program

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


Re: how to generate a csr in python?

2010-06-01 Thread holmes86
On May 31, 7:37 pm, holmes86  wrote:
> hi,everyone
>
> I want generate a Certificate signing request in python,but I don't
> how to realize this function.I don't find any method after read the
> python-openssl manual.Any help will appreciate.

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


Re: how to generate a csr in python?

2010-06-01 Thread Peter Otten
holmes86 wrote:

> On May 31, 7:37 pm, holmes86  wrote:
>> hi,everyone
>>
>> I want generate a Certificate signing request in python,but I don't
>> how to realize this function.I don't find any method after read the
>> python-openssl manual.Any help will appreciate.
> 
> nobody?

Is the createCertRequest() function at

http://bazaar.launchpad.net/~exarkun/pyopenssl/trunk/annotate/head:/examples/certgen.py

what you're looking for?

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


Re: Problems with relative imports and pep 366

2010-06-01 Thread Jean-Michel Pichavant

Gabriele Lanaro wrote:

I've yet asked this question on SO, I'll copy the contents:

I have a "canonical file structure" like that (I'm giving sensible names
to ease the reading):

mainpack/

  __main__.py
  __init__.py 


  - helpers/
 __init__.py
 path.py

  - network/
 __init__.py
 clientlib.py
 server.py

  - gui/
 __init__.py
 mainwindow.py
 controllers.py

In this structure, for example modules contained in each package may
want to access the helpers utilities through relative imports in
something like:

# network/clientlib.py
from ..helpers.path import create_dir

The program is runned "as a script" using the __main__.py file in this
way:

python mainpack/

Trying to follow the PEP 366 I've put in __main__.py these lines:

___package___ = "mainpack"
from .network.clientlib import helloclient 


But when running:

$ python mainpack 
Traceback (most recent call last):

  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
  File "path/mainpack/__main__.py", line 2, in 
from .network.clientlib import helloclient
SystemError: Parent module 'mainpack' not loaded, cannot perform relative import

What's wrong? What is the correct way to handle and effectively use
relative imports?

I've tried also to add the current directory to the PYTHONPATH, nothing
changes.

link:
http://stackoverflow.com/questions/2943847/nightmare-with-relative-imports-how-does-pep-366-work


  
I'm not using relative imports at all, so I can't help you on that 
point, however, did you consider using absolute imports ? The world 
becomes so simple with these :) .


BTW,

___package___ = "mainpack"


looks weird to me, are you sure it would not be better with

__package__ = "mainpack" # only 2 leading/traling underscore


JM

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


Hashbang error

2010-06-01 Thread pradeepbpin
I use gVim as an editor to create python scripts on a windows machine.
To run the same script on my ubuntu machine, I added a hashbang line
to the script. Now when I run this script from command line of ubuntu,
I get a bad interpreter error, like below

/usr/bin/python^M: bad interpreter: No such file or directory

This, I understand, is due to the interpretation of newline character
at the end of the hashbang.

I have checked and found out that this does not happen if I create the
script in Ubuntu with gVim.

Now, how can I avoid this error when I create the script on a windows
machine?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs. Fedora and CentOS

2010-06-01 Thread Adam Tauno Williams
On Sat, 2010-05-29 at 11:43 -0700, John Nagle wrote:
> The major Red Hat based Linux distros are still shipping with Python 2.4.
> As a result, almost all hosting providers are running obsolete versions of
> Python.
>The big problem seems to be that "cPanel" and "yum" still use older 
> versions
> of Python, and those programs are more important to distro builders than 
> Python
> itself.
>Is anybody trying to do something about this?

Yes, we install Python 2.6 on CentOS and run a production app on it - no
problems.

rpm -Uvh
http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1-4.ius.el5.noarch.rpm

yum -y install python26 python26-setuptools




-- 
Adam Tauno Williams  LPIC-1, Novell CLA

OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

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


Re: Hashbang error

2010-06-01 Thread Cameron Simpson
On 01Jun2010 03:56, pradeepbpin  wrote:
| I use gVim as an editor to create python scripts on a windows machine.
| To run the same script on my ubuntu machine, I added a hashbang line
| to the script. Now when I run this script from command line of ubuntu,
| I get a bad interpreter error, like below
| 
| /usr/bin/python^M: bad interpreter: No such file or directory
| 
| This, I understand, is due to the interpretation of newline character
| at the end of the hashbang.
| 
| I have checked and found out that this does not happen if I create the
| script in Ubuntu with gVim.
| 
| Now, how can I avoid this error when I create the script on a windows
| machine?

The standard approach is to copy the file to the unix machine and use
the dos2unix command.
-- 
Cameron Simpson  DoD#743
http://www.cskk.ezoshosting.com/cs/

A pessimist is an optimist in full possession of the facts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hashbang error

2010-06-01 Thread Rebelo

On 06/01/2010 12:56 PM, pradeepbpin wrote:

I use gVim as an editor to create python scripts on a windows machine.
To run the same script on my ubuntu machine, I added a hashbang line
to the script. Now when I run this script from command line of ubuntu,
I get a bad interpreter error, like below

/usr/bin/python^M: bad interpreter: No such file or directory

This, I understand, is due to the interpretation of newline character
at the end of the hashbang.

I have checked and found out that this does not happen if I create the
script in Ubuntu with gVim.

Now, how can I avoid this error when I create the script on a windows
machine?



check if there is an option like in Geany to select encoding and line 
endings

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


What does this PyChecker warning mean?

2010-06-01 Thread Leo Breebaart

When fed the following code:

 def Foo():

class A(object):
def __init__(self):
pass

class B(object):
def __init__(self):
pass

PyChecker 0.8.18 warns:

  foo.py:9: Redefining attribute (__init__) original line (5)

I do not understand what is meant by this warning. In fact, it
simply seems wrong -- but I have learned not to jump to that
conclusion too quickly, so I was hoping someone here could
perhaps enlighten me...

Many thanks in advance,

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


Re: What does this PyChecker warning mean?

2010-06-01 Thread Xavier Ho
On 1 June 2010 21:48, Leo Breebaart  wrote:

>
> When fed the following code:
>
>  def Foo():
>
>class A(object):
>def __init__(self):
>pass
>
>class B(object):
>def __init__(self):
>pass
>
> PyChecker 0.8.18 warns:
>
>  foo.py:9: Redefining attribute (__init__) original line (5)
>

Out of curiosity, why are you defining two classes inside a function?

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


Re: [Python] Hashbang error

2010-06-01 Thread Chris Gonnerman

pradeepbpin wrote:

I use gVim as an editor to create python scripts on a windows machine.
To run the same script on my ubuntu machine, I added a hashbang line
to the script. Now when I run this script from command line of ubuntu,
I get a bad interpreter error, like below

/usr/bin/python^M: bad interpreter: No such file or directory

This, I understand, is due to the interpretation of newline character
at the end of the hashbang.

I have checked and found out that this does not happen if I create the
script in Ubuntu with gVim.

Now, how can I avoid this error when I create the script on a windows
machine?
  

In gvim, type:

:se ff=unix

then resave the file.  Once it's in unix format, gvim won't change it 
back to dos unless you tell it to.


-- Chris.

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


expat parsing error

2010-06-01 Thread kak...@gmail.com
Hi i'm doing the following:

def start_element(name, attrs):
print 'Start element:', name, attrs
def end_element(name):
print 'End element:', name
def char_data(data):
print 'Character data:', repr(data)

class SimpleServer(LineReceiver): # Using Twisted

def connectionMade(self):
print 'Connection from: ', self.transport.client

def connectionLost(self, reason):
print self.transport.client, 'Disconnected'

def dataReceived(self, line):
"""Here the XML Parser"""

p = xml.parsers.expat.ParserCreate()

p.StartElementHandler = start_element
p.EndElementHandler = end_element
p.CharacterDataHandler = char_data
p.Parse(line, 1)

I got the following error
---  ---
  File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
x86_64.egg/twisted/internet/selectreactor.py", line 146, in
_doReadOrWrite
why = getattr(selectable, method)()
  File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
x86_64.egg/twisted/internet/tcp.py", line 460, in doRead
return self.protocol.dataReceived(data)
  File "stdiodemo.py", line 419, in dataReceived
p.Parse(line, 1)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0


The XML Message is coming in the form of:

POST /test/pcp/Listener HTTP/1.1
user-agent:hjahsjdhaskd asdja d
Host:127.0.0.1
Content-Length: 547

http://bytemobile.com/pttv";>
  
200
OK, found 5 session entries

  
06d4d59bf8f1abf57cadfe10139dd874
82
android
  

  


Please give me some hints
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does this PyChecker warning mean?

2010-06-01 Thread Peter Otten
Leo Breebaart wrote:

> 
> When fed the following code:
> 
>  def Foo():
> 
> class A(object):
> def __init__(self):
> pass
> 
> class B(object):
> def __init__(self):
> pass
> 
> PyChecker 0.8.18 warns:
> 
>   foo.py:9: Redefining attribute (__init__) original line (5)
> 
> I do not understand what is meant by this warning. In fact, it
> simply seems wrong -- but I have learned not to jump to that
> conclusion too quickly, so I was hoping someone here could
> perhaps enlighten me...

You are right, that's a false positive. pychecker seems to confuse the 
namespaces.

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


expat parsing error

2010-06-01 Thread kak...@gmail.com
Hi i'm doing the following:

def start_element(name, attrs):
print 'Start element:', name, attrs
def end_element(name):
print 'End element:', name
def char_data(data):
print 'Character data:', repr(data)

class SimpleServer(LineReceiver): # Using Twisted

def connectionMade(self):
print 'Connection from: ', self.transport.client

def connectionLost(self, reason):
print self.transport.client, 'Disconnected'

def dataReceived(self, line):
"""Here the XML Parser"""

p = xml.parsers.expat.ParserCreate()

p.StartElementHandler = start_element
p.EndElementHandler = end_element
p.CharacterDataHandler = char_data
p.Parse(line, 1)

I got the following error
---  ---
  File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
x86_64.egg/twisted/internet/selectreactor.py", line 146, in
_doReadOrWrite
why = getattr(selectable, method)()
  File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
x86_64.egg/twisted/internet/tcp.py", line 460, in doRead
return self.protocol.dataReceived(data)
  File "stdiodemo.py", line 419, in dataReceived
p.Parse(line, 1)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0

The XML Message is coming in the form of:

POST /test/pcp/Listener HTTP/1.1
user-agent:hjahs
Host:127.0.0.1
Content-Length: 547

http://1270.0.01/pttv";>
  
200
OK, found 5 session entries

  
06d4d59bfdfe10139dd874
82
and
  

  


Please give me some hints
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Returning value from home made unit - how to?

2010-06-01 Thread bobicanprogram
On May 30, 6:22 pm, Mel  wrote:
> Martin Hvidberg wrote:
> > I have a Python program, which has until now, been running in command line
> > mode only. I wish to add a GUI.
>
> > I would like to develop (and maintain) the GUI part in a separate module,
> > i.e. in its own .py file, and then ‘import’ that into the old main
> > program.
>
> > I jumped into wxPython, as it seems to be the right GUI for me, and
> > downloaded some examples that I took apart and joined. Now the basic GUI
> > is running, though neither beautiful nor complete.
>
> > The main task for my GUI is to allow the user to point to an input file.
> > It can now obtain a filename from a file selection dialog, but I can’t
> > figure out how to get the filename, i.e. the string variable containing
> > the file name, send back to the main program…
>
> > I attach the two .py files hereunder.
>
> > My question is:
> > How do I get the information from variable strSequenceFile, back to the
> > main module in file jacxl.py ?
>
> AFAIK, typically, you don't -- the way it is here.  Returning a value from a
> Button handler, or any event handler generally, won't have any effect.  The
> event handlers are called from deep in wx code by routines that don't deal
> with anything specific to the data-processing side of the program.
>
> What I think you might do is to make strSequenceFile an attribute of your
> Frame, so that OnFindFile button does ``self.strSequenceFile =
> dialog.GetPath()'' rather than returning that value.
>
> Then your main level can do ``jacXlgui.app.GetTopWindow().strSequenceFile''
> .
>
> There are probably refinements to be added to this, but I think it's a good
> beginning strategy.  The first new place I would take the whole program
> would be to remove the command-line controls from the command line program,
> so you're left with a sort of "business model" that contains only the data
> processing.  Then you can write a new GUI program based on jacXlgui that
> imports the  data processing module and calls computations and reports
> results from the model.
>
> Mel.


Another way to encapsulate functionality like a GUI is to "hide" it
behind a nice clean messaging interface.  The SIMPL toolkit (http://
www.icanprogram.com/06py/lesson1/lesson1.html) promotes this kind of
design.  SIMPL allows Python to Python messaging as well as Python to
C, C++, JAVA or Tcl/Tk so what you ultimately choose for the GUI has
only minimal impact on what you choose for your "processing engine".

Happy coding.

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


labels legibility in matplotlib pie charts and bar plots

2010-06-01 Thread meow
Hi,

   As a beginner in python and matplotlib I come here with a possibly
naïve question. I need to write code for automation of bar-plots and
pie-charts creation. I chose to use matplotlib which is well adapted
for this purpose. Nevertheless, some of my charts are not very legible
due to interferences between to many or to long labels.

Sometimes my labels spread over the edge of the picture, and therefore
are simply cut out; sometimes the different labels superpose,
resulting in an illegible pie-chart.

Do you know an easy way to control the labels size and repartition ?
Is it possible to prohibit the label cutting, for instance a way to
set the picture size so that no label is cut anymore ?
Does matplotlib provide an easy way to spread labels or pie chunks so
that the labels do not interfere with each other ?

 You will find my two code samples here after

  Any hint or recommendation appreciated
  --Ben

# pie chart code
#
def savePie(populationGO,filepath,figtitle):
""" saves Pie Charts of a population to a file """
plt.figure(figsize=(8,8))
labels=[k+"\n"+str(v) for k,v in populationGO.iteritems()]
plt.clf();
plt.pie
(populationGO.values(),labels=labels,labeldistance=1.1,autopct='%1.1f%
%',pctdistance=.8)
plt.title(figtitle)
plt.savefig(filepath)

# bar plot code
#
barPlotWidth=.25
plt.clf()
barPlotOffsets = np.arange(len(labels))
r1  =
plt.bar(barPlotOffsets  ,popGO  
,color="r",width=barPlotWidth)
r2  = plt.bar(barPlotOffsets
+barPlotWidth ,popGOall   ,color="g",width=barPlotWidth)
r3  = plt.bar(barPlotOffsets
+(2*barPlotWidth) ,popGOlowr  ,color="b",width=barPlotWidth)
plt.ylabel('Population (number of protein chains)')
plt.title('GO Population by simplified GO and dataset')
plt.xticks(barPlotOffsets+barPlotWidth, labels,rotation = 17 )
plt.legend( (r1[0],r2[0],r3[0]), ("all SIFTS annotated","all PDB
protein chains","all PDB p.chains R<=2.1") )
print "\nSave comparative bar plot file"
fileName = "GO-population--comparative-bar-plot.png"
print "...",fileName
filepath=os.path.join(pc.resDir,fileName)
plt.savefig(filepath)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: expat parsing error

2010-06-01 Thread John Bokma
"kak...@gmail.com"  writes:

> I got the following error
> ---  ---
>   File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
> x86_64.egg/twisted/internet/selectreactor.py", line 146, in
> _doReadOrWrite
> why = getattr(selectable, method)()
>   File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
> x86_64.egg/twisted/internet/tcp.py", line 460, in doRead
> return self.protocol.dataReceived(data)
>   File "stdiodemo.py", line 419, in dataReceived
> p.Parse(line, 1)
> xml.parsers.expat.ExpatError: syntax error: line 1, column 0
>
>
> The XML Message is coming in the form of:
>
> POST /test/pcp/Listener HTTP/1.1

Does Expat get this line as well? If so, that's the reason why you get
an error at line 1, column 0.

-- 
John Bokma   j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: expat parsing error

2010-06-01 Thread kak...@gmail.com
On Jun 1, 9:51 am, John Bokma  wrote:
> "kak...@gmail.com"  writes:
> > I got the following error
> > ---  ---
> >   File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
> > x86_64.egg/twisted/internet/selectreactor.py", line 146, in
> > _doReadOrWrite
> >     why = getattr(selectable, method)()
> >   File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
> > x86_64.egg/twisted/internet/tcp.py", line 460, in doRead
> >     return self.protocol.dataReceived(data)
> >   File "stdiodemo.py", line 419, in dataReceived
> >     p.Parse(line, 1)
> > xml.parsers.expat.ExpatError: syntax error: line 1, column 0
>
> > The XML Message is coming in the form of:
>
> > POST /test/pcp/Listener HTTP/1.1
>
> Does Expat get this line as well? If so, that's the reason why you get
> an error at line 1, column 0.
>
> --
> John Bokma                                                               j3b
>
> Hacking & Hiking in Mexico -  http://johnbokma.com/http://castleamber.com/- 
> Perl & Python Development

Yes but how can i fix it, how to "ignore" the headers and parse only
the XML?
Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does this PyChecker warning mean?

2010-06-01 Thread Steven W. Orr

On 6/1/2010 7:53 AM, Xavier Ho wrote:

On 1 June 2010 21:48, Leo Breebaart mailto:l...@lspace.org>> wrote:


When fed the following code:

  def Foo():

class A(object):
def __init__(self):
pass

class B(object):
def __init__(self):
pass

PyChecker 0.8.18 warns:

  foo.py:9: Redefining attribute (__init__) original line (5)


Out of curiosity, why are you defining two classes inside a function?

-Xav



In terms of constructing a minimal example, Foo might be fodder for a closure 
that either returns A or B. Just s stab in the dark...



--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: expat parsing error

2010-06-01 Thread John Bokma
"kak...@gmail.com"  writes:

> On Jun 1, 9:51 am, John Bokma  wrote:
>> "kak...@gmail.com"  writes:
>> > I got the following error
>> > ---  ---
>> >   File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
>> > x86_64.egg/twisted/internet/selectreactor.py", line 146, in
>> > _doReadOrWrite
>> >     why = getattr(selectable, method)()
>> >   File "/usr/lib/python2.6/site-packages/Twisted-10.0.0-py2.6-linux-
>> > x86_64.egg/twisted/internet/tcp.py", line 460, in doRead
>> >     return self.protocol.dataReceived(data)
>> >   File "stdiodemo.py", line 419, in dataReceived
>> >     p.Parse(line, 1)
>> > xml.parsers.expat.ExpatError: syntax error: line 1, column 0
>>
>> > The XML Message is coming in the form of:
>>
>> > POST /test/pcp/Listener HTTP/1.1
>>
>> Does Expat get this line as well? If so, that's the reason why you get
>> an error at line 1, column 0.
>
> Yes but how can i fix it, how to "ignore" the headers and parse only
> the XML?

The headers are followed by exactly one empty line, so you you simply
could remove lines up until including this empty line and then hand over
the data to the parser.

-- 
John Bokma   j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: expat parsing error

2010-06-01 Thread Stefan Behnel

kak...@gmail.com, 01.06.2010 16:00:

how can i fix it, how to "ignore" the headers and parse only
the XML?


Consider reading the answers you got in the last thread that you opened 
with exactly this question.


Stefan

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


Re: expat parsing error

2010-06-01 Thread kak...@gmail.com
On Jun 1, 10:34 am, Stefan Behnel  wrote:
> kak...@gmail.com, 01.06.2010 16:00:
>
> > how can i fix it, how to "ignore" the headers and parse only
> > the XML?
>
> Consider reading the answers you got in the last thread that you opened
> with exactly this question.
>
> Stefan

That's exactly, what i did but something seems to not working with the
solutions i had, when i changed my implementation from pure Python's
sockets to twisted library!
That's the reason i have created a new post!
Any ideas why this happened?
Thanks Stefan

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


Re: expat parsing error

2010-06-01 Thread John Bokma
"kak...@gmail.com"  writes:

> On Jun 1, 10:34 am, Stefan Behnel  wrote:
>> kak...@gmail.com, 01.06.2010 16:00:
>>
>> > how can i fix it, how to "ignore" the headers and parse only
>> > the XML?
>>
>> Consider reading the answers you got in the last thread that you opened
>> with exactly this question.
>>
>> Stefan
>
> That's exactly, what i did but something seems to not working with the
> solutions i had, when i changed my implementation from pure Python's
> sockets to twisted library!
> That's the reason i have created a new post!
> Any ideas why this happened?

As I already explained: if you send your headers as well to any XML
parser it will choke on those, because the headers are /not/ valid /
well-formed XML. The solution is to remove the headers from your
data. As I explained before: headers are followed by one empty
line. Just remove lines up and until including the empty line, and pass
the data to any XML parser.

-- 
John Bokma   j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: expat parsing error

2010-06-01 Thread kak...@gmail.com
On Jun 1, 11:09 am, John Bokma  wrote:
> "kak...@gmail.com"  writes:
> > On Jun 1, 10:34 am, Stefan Behnel  wrote:
> >> kak...@gmail.com, 01.06.2010 16:00:
>
> >> > how can i fix it, how to "ignore" the headers and parse only
> >> > the XML?
>
> >> Consider reading the answers you got in the last thread that you opened
> >> with exactly this question.
>
> >> Stefan
>
> > That's exactly, what i did but something seems to not working with the
> > solutions i had, when i changed my implementation from pure Python's
> > sockets to twisted library!
> > That's the reason i have created a new post!
> > Any ideas why this happened?
>
> As I already explained: if you send your headers as well to any XML
> parser it will choke on those, because the headers are /not/ valid /
> well-formed XML. The solution is to remove the headers from your
> data. As I explained before: headers are followed by one empty
> line. Just remove lines up and until including the empty line, and pass
> the data to any XML parser.
>
> --
> John Bokma                                                               j3b
>
> Hacking & Hiking in Mexico -  http://johnbokma.com/http://castleamber.com/- 
> Perl & Python Development

Thank you so much i'll try it!
Antonis
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does this PyChecker warning mean?

2010-06-01 Thread Leo Breebaart
On 6/1/2010 7:53 AM, Xavier Ho wrote:

> > Out of curiosity, why are you defining two classes inside a
> > function?

Not my code! Not my code! :-)

This code was contributed by someone else, and I merely took my
default action (in such cases) of running pyflakes, pychecker,
and pylint on it before doing anything else, just to see what
comes up.

As far as I can tell the sole reason for that code being
structured the way it is, is to provide a kind of
module-within-a-module and not clutter up the outer module with
these helper classes needed only by the foo() function.

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


Re: What does this PyChecker warning mean?

2010-06-01 Thread Terry Reedy

On 6/1/2010 8:23 AM, Peter Otten wrote:

Leo Breebaart wrote:



When fed the following code:

  def Foo():

 class A(object):
 def __init__(self):
 pass

 class B(object):
 def __init__(self):
 pass

PyChecker 0.8.18 warns:

   foo.py:9: Redefining attribute (__init__) original line (5)

I do not understand what is meant by this warning. In fact, it
simply seems wrong -- but I have learned not to jump to that
conclusion too quickly, so I was hoping someone here could
perhaps enlighten me...


You are right, that's a false positive. pychecker seems to confuse the
namespaces.


Consider sending this example back to the pychecker author.
The program does not seem to be interpreting the nested class statements 
properly.




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


Re: multiprocessing and accessing server's stdout

2010-06-01 Thread Tim Arnold
On May 28, 7:47 pm, "Martin P. Hellwig" 
wrote:
> On 05/28/10 21:44, Adam Tauno Williams wrote:
>
> > On Fri, 2010-05-28 at 15:41 +0100, Martin P. Hellwig wrote:
> >> On 05/28/10 13:17, Adam Tauno Williams wrote:
> >> 
> >>> You should be able to point it any any file-like object.  But, again,
> >>> why?
> >>> If you have the data in the process why send it tostdoutand redirect
> >>> it.  Why not just send the data to the client directly?
> >> Well you might want to multiplex it to more then one client, not saying
> >> that this is the case here, just something I imagine possible.
>
> > That still doesn't make sense.  Why 'multiplexstdout'?  Why not just
> > multiplex the data into proper IPC channels in the first place?
>
> I am going on a stretch here, I mostly agree with you, just trying to
> illustrate that there could be corner cases where this is sensible.
> The current situation could be that there is a client/server program
> (binary only perhaps) which is not multi-user safe.
>
> Python can be used as a wrapper around the server to make it
> multi-client, by emulating the exact behavior towards the client, the
> client program does not have to be changed.
>
> --
> mph

Hi, This is the setup I was asking about.
I've got users using a python-written command line client. They're
requesting services from a remote server that fires a LaTeX process. I
want them to see the stdout from the LaTeX process.

I was using multiprocessing to handle the requests, but the stdout
shows up on the server's terminal window where I started the
server.serve_forever process.

I started using RPyC and now the stdout appears on the client terminal
making the request.

I was trying to minimize the number of packages I use, hoping I could
get the same capability from multiprocessing that I get with RPyC.

thanks for the comments. I'm still processing what's been written
here.
--Tim

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


Re: expat parsing error

2010-06-01 Thread kak...@gmail.com
On Jun 1, 11:12 am, "kak...@gmail.com"  wrote:
> On Jun 1, 11:09 am, John Bokma  wrote:
>
>
>
> > "kak...@gmail.com"  writes:
> > > On Jun 1, 10:34 am, Stefan Behnel  wrote:
> > >> kak...@gmail.com, 01.06.2010 16:00:
>
> > >> > how can i fix it, how to "ignore" the headers and parse only
> > >> > the XML?
>
> > >> Consider reading the answers you got in the last thread that you opened
> > >> with exactly this question.
>
> > >> Stefan
>
> > > That's exactly, what i did but something seems to not working with the
> > > solutions i had, when i changed my implementation from pure Python's
> > > sockets to twisted library!
> > > That's the reason i have created a new post!
> > > Any ideas why this happened?
>
> > As I already explained: if you send your headers as well to any XML
> > parser it will choke on those, because the headers are /not/ valid /
> > well-formed XML. The solution is to remove the headers from your
> > data. As I explained before: headers are followed by one empty
> > line. Just remove lines up and until including the empty line, and pass
> > the data to any XML parser.
>
> > --
> > John Bokma                                                               j3b
>
> > Hacking & Hiking in Mexico -  
> > http://johnbokma.com/http://castleamber.com/-Perl & Python Development
>
> Thank you so much i'll try it!
> Antonis

Dear John can you provide me a simple working solution?
I don't seem to get it
-- 
http://mail.python.org/mailman/listinfo/python-list


Drawing Multigraphs

2010-06-01 Thread Nima
Hi there,
Is it possible to draw an (undirected) multigraph using a python library?
I need to write a program that finds an Eulerian circuit in a graph
(which might obviously be a multigraph). As the output of the program,
I should draw the graph and print out the solution.

I asked my question at NetworkX discussion group. They told me that
matplotlib, which provides drawing routines for NetworkX, doesn't show
multiple edges and I have to pass the graph to another graph drawing
package (if there is one!).

* I've used the Fleury's algorithm to solve the problem.
--
Yours sincerely,
Nima Mohammadi
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs. Fedora and CentOS

2010-06-01 Thread Michael Torrie
On 05/31/2010 05:13 AM, Jason D wrote:
> There is however never been an issue to locate different version of python 
> in your system as you deem fit without problems. 
> So I dont understand why your concern.

Actually, replacing python on RHEL is a major endeavor.  Almost all Red
Hat utilities are written in python and depend on the specific system
version of python that they shipped.  Thus if you want to upgrade python
you're going to break 80% of the system.

Sure you can install Python from source alongside the system python, but
that's a maintenance nightmare for system administrators.  I administer
some 30 RHEL instances, and compiling from source just isn't a good
option here.  As for third-party RPMs, that's all fine and well as long
as you don't need any support from Red Hat.  RH can only support
software they ship and certify.  As for me, I don't need RH to support
my custom RPMs, so I think that's probably a fair compromise.  It would
be nice to have a source (that's kept up to date security-wise) of
python packages that can be installed alongside RH system ones.  Maybe
call it python26 or python28 or python31 and stick it in the EPEL
repository.  I am supposing that if anyone wanted to do this, the EPEL
folks would be happy to let that person be the package maintainer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs. Fedora and CentOS

2010-06-01 Thread Michael Torrie
On 06/01/2010 05:01 AM, Adam Tauno Williams wrote:
> Yes, we install Python 2.6 on CentOS and run a production app on it - no
> problems.
> 
> rpm -Uvh
> http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1-4.ius.el5.noarch.rpm
> 
> yum -y install python26 python26-setuptools

Thanks for posting this link.  Very useful and interesting.

The only problem I have is how do I tell what third-party repositories
are to be trusted in my production systems?  And even more important,
which repositories are actually going to keep up to date on security
updates in the long run?   It's hard to know.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs. Fedora and CentOS

2010-06-01 Thread Adam Tauno Williams
On Tue, 2010-06-01 at 10:43 -0600, Michael Torrie wrote:
> On 05/31/2010 05:13 AM, Jason D wrote:
> > There is however never been an issue to locate different version of python 
> > in your system as you deem fit without problems. 
> > So I dont understand why your concern.
> 
> Actually, replacing python on RHEL is a major endeavor.

Then don't do it.  Just install Python 2.6.  Who cares what version of
Python the system utilities use?

>   Almost all Red
> Hat utilities are written in python and depend on the specific system
> version of python that they shipped.  Thus if you want to upgrade python
> you're going to break 80% of the system.
> 
> Sure you can install Python from source alongside the system python, but
> that's a maintenance nightmare for system administrators.

No, it is not.  It is trivial.  The packages don't overlap at all.

You run python2.6, easy_install-2.6, etc... and the app merrily runs.

>   I administer
> some 30 RHEL instances, and compiling from source just isn't a good
> option here.  As for third-party RPMs, that's all fine and well as long
> as you don't need any support from Red Hat.  RH can only support
> software they ship and certify.

In my experience RedHat supports their system - *not* the software you
run on it.  So they don't care either way.

>   As for me, I don't need RH to support
> my custom RPMs, so I think that's probably a fair compromise.  It would
> be nice to have a source (that's kept up to date security-wise) of
> python packages that can be installed alongside RH system ones.  Maybe
> call it python26 or python28 or python31 and stick it in the EPEL
> repository.  I am supposing that if anyone wanted to do this, the EPEL
> folks would be happy to let that person be the package maintainer.

rpm -Uvh
http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1-4.ius.el5.noarch.rpm
yum -y install python26 python26-setuptools 

-- 
Adam Tauno Williams  LPIC-1, Novell CLA

OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

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


Re: Python vs. Fedora and CentOS

2010-06-01 Thread Adam Tauno Williams
On Tue, 2010-06-01 at 10:55 -0600, Michael Torrie wrote:
> On 06/01/2010 05:01 AM, Adam Tauno Williams wrote:
> > Yes, we install Python 2.6 on CentOS and run a production app on it - no
> > problems.
> > rpm -Uvh
> > http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1-4.ius.el5.noarch.rpm
> > yum -y install python26 python26-setuptools
> Thanks for posting this link.  Very useful and interesting.
> The only problem I have is how do I tell what third-party repositories
> are to be trusted in my production systems?  And even more important,
> which repositories are actually going to keep up to date on security
> updates in the long run?   It's hard to know.

I don't know about "third-party repositories",  but IUS is solid.
They've been around since 2006.



-- 
Adam Tauno Williams  LPIC-1, Novell CLA

OpenGroupware, Cyrus IMAPd, Postfix, OpenLDAP, Samba

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


Re: Drawing Multigraphs

2010-06-01 Thread geremy condra
On Tue, Jun 1, 2010 at 9:42 AM, Nima  wrote:
> Hi there,
> Is it possible to draw an (undirected) multigraph using a python library?
> I need to write a program that finds an Eulerian circuit in a graph
> (which might obviously be a multigraph). As the output of the program,
> I should draw the graph and print out the solution.

We use Dot in Graphine, and it works well. It's also very easy to
output to.

Geremy Condra

(sent to the list this time)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQLDB - server has gone on blob insertion...

2010-06-01 Thread durumdara
Hi!

>
> drop table blobs
> create table blobs (whatever definition it had originally)

It was a test. In PGSQL, PYSQLite that was:

delete from blobs where (file_id in (select file_id from pics where
dir_id=?))

So I need to delete only all blobs that processed.

>
>
>
> > When I tried to start this, I got error:
>
> > _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
>
> > I read that server have some parameter, that limit the Query length.
>
> > Then I decreased the blob size to 1M, and then it is working.
>
>         What is the table definition? In MySQL 4 (and likely not changed in
> v5 -- I've got the old brown tree book handy, hence the mention of v4)
> field type BLOB is limited to a length of 2^16 (64kB), MEDIUMBLOB is
> 2^24, and LONGBLOB is 2^32 (if the system is using unsigned integers
> internally, that should support 4GB...

I used the latest community server.
I tried LONGBLOB also, and I got also this error... :-(

>But do you have enough memory to
> pass such an argument?

I have enough memory (4 GB), I want to insert only 1-8 MB size
pictures, that is working under PYSQLITE/PGSQL.
I saw that packet size need to configure - may mysqldb don't handle
this with right error message, replace with "gone" error.
I set these packet, and other parameters in my.ini, and I restarted
the mysql, but this don't solve the problem.

May I need to set this from client, but I don't know, how to do it...

Thanks for every help:
   dd
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What does this PyChecker warning mean?

2010-06-01 Thread MrJean1
Although PyChecker 0.8.18 is quite an improvement over previous
releases, it does have quirks.  The PyChecker postprocessor might be
helpful, see

  

/Jean


On Jun 1, 4:48 am, Leo Breebaart  wrote:
> When fed the following code:
>
>  def Foo():
>
>     class A(object):
>         def __init__(self):
>             pass
>
>     class B(object):
>         def __init__(self):
>             pass
>
> PyChecker 0.8.18 warns:
>
>   foo.py:9: Redefining attribute (__init__) original line (5)
>
> I do not understand what is meant by this warning. In fact, it
> simply seems wrong -- but I have learned not to jump to that
> conclusion too quickly, so I was hoping someone here could
> perhaps enlighten me...
>
> Many thanks in advance,
>
> --
> Leo Breebaart  

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


python and filter design: calculating "s" optimal transform

2010-06-01 Thread robert somerville
Hi;
this is an airy question.

does anybody have some code or ideas on how to calculate the optimal "S"
transform of user specified order (wanting the coefficients)  for a
published filter response curve, ie.

f(s) = 1.0/(a1*S^2 + a2*S + a3)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing Multigraphs

2010-06-01 Thread Nima
2010/6/1 geremy condra 
>
> We use Dot in Graphine, and it works well. It's also very easy to
> output to.


> Graphine is a flexible, easy-to-use graph library for Python 3.

I always knew a day would come when I'd need to use Python 3. And I've
been so stupid thinking I could run away from this everlasting misery!
Can you give me an example of drawing a simple graph by Graphine?

I'm gonna use PyQt as GUI. Doesn't Qt provide any facility for drawing a graph?

BTW, I just found this page: http://nodebox.net/code/index.php/Graphing
Has anyone tried it out?

--
Yours sincerely,
Nima Mohammadi
-- 
http://mail.python.org/mailman/listinfo/python-list


Fashion serious in 2010

2010-06-01 Thread ekr3d
Man Fashion Week: Z Zegna Spring 2010 Collection

fashion-ekramy.blogspot.com/2010/04/man-fashion-week-z-zegna-
spring-2010.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing Multigraphs

2010-06-01 Thread geremy condra
On Tue, Jun 1, 2010 at 11:24 AM, Nima  wrote:
> 2010/6/1 geremy condra 
>>
>> We use Dot in Graphine, and it works well. It's also very easy to
>> output to.
>
>
>> Graphine is a flexible, easy-to-use graph library for Python 3.
>
> I always knew a day would come when I'd need to use Python 3. And I've
> been so stupid thinking I could run away from this everlasting misery!
> Can you give me an example of drawing a simple graph by Graphine?

from graph.base import Graph
from graph.extras import dot
from subprocess import getstatusoutput

# build a circular graph
g = Graph(edges=['ab', 'bc', 'cd', 'da'])

# build the drawing tool
drawer = dot.DotGenerator()

# populate the output file
with open('graph.dot', 'w') as f:
output = drawer.draw(g, "my_graph")
f.write(output)

# call circo, which will produce the best results here
status, output = getstatusoutput("circo -Tgif -o graph.gif -v graph.dot")


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


Re: MySQLDB - server has gone on blob insertion...

2010-06-01 Thread John Nagle

durumdara wrote:

When I tried to start this, I got error:
_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')


   Are you by any chance trying to do this on a HostGator account?
HostGator servers run a program which kills long MySQL transactions
by executing MySQL "KILL" transactions.
This is reported to the user as 'MySQL server has gone away'

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


Re: python and filter design: calculating "s" optimal transform

2010-06-01 Thread Terry Reedy

On 6/1/2010 2:18 PM, robert somerville wrote:

Hi;
this is an airy question.

does anybody have some code or ideas on how to calculate the optimal "S"
transform of user specified order (wanting the coefficients)  for a
published filter response curve, ie.

f(s) = 1.0/(a1*S^2 + a2*S + a3)


If you do not get an answer here, try the scipy list.


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


TypeError: list indices must be integers

2010-06-01 Thread Terry Reedy

I got this error twice today
while creating lists of lists
of complicated stuff.
The first time I was puzzled,
but the second time I knew
that I had just forgotten a comma.
If you google this, you will too.

Reduced example
>>> [[1,2,3] # forgot comma
 [4,5,6]]
Traceback (most recent call last):
  File "", line 2, in 
[4,5,6]]
TypeError: list indices must be integers, not tuple

Terry Jan Reedy


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


Re: TypeError: list indices must be integers

2010-06-01 Thread Jon Clements
On 1 June, 23:06, Terry Reedy  wrote:
> I got this error twice today
> while creating lists of lists
> of complicated stuff.
> The first time I was puzzled,
> but the second time I knew
> that I had just forgotten a comma.
> If you google this, you will too.
>
> Reduced example
>  >>> [[1,2,3] # forgot comma
>       [4,5,6]]
> Traceback (most recent call last):
>    File "", line 2, in 
>      [4,5,6]]
> TypeError: list indices must be integers, not tuple
>
> Terry Jan Reedy

Umm... +1 for poetic effort?

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


Challenging Job Opportunity for a C# Architect/ Developer

2010-06-01 Thread Suganthi Vincent
Hi

My name is Suganthi Vincent and I’m with Metabyte, Inc.

I have a challenging Job Opportunity for a C# Architect/ Developer, a
4 months contract to hire  opportunity located in Wheeling, IL.

Please find the job details.

Title: C# Architect/ Developer
Location: Wheeling, IL
Rates: Market Rate

Please find the job description from the Hiring managers desk:

1.  Real C# Experience
a.  I am looking for someone that has actually released a commercial
software product that was developed and successfully released into the
market.  We are developing desktop applications that will run on both
Windows XP (Windows 7) and SuSE Linux Enterprise Edition 11.
b.  I am not looking for someone who merely knows of C# and has read a
book or two.
c.  I am also not interested in anyone that has done web development.
If they have, great, but they better have solid desktop application
development experience first.
2.  Mono Experience
a.  I really need someone that has experience in writing C#
applications for Mono.  Just so you know, C# runs on .Net and Mono is
an open source software framework that emulates a subset(or part)
of .Net, which in turn will allow applications written in C# targeted
for Mono to run on many systems that Mono has been ported to, such as:
Windows XP and SuSE Linux Enterprise Edition 11.
b.  Just because someone has written an application in C# and in theory
C# applications should run on Mono simply is not true.  Mono is a
rather small subset of the entire .Net framework and I’ve already gone
way beyond the theory stage.  I have personally already written
applications that run on Mono that in turn run on both Windows XP and
SuSE Linux Enterprise Edition 11, so I don’t want to explain how this
works during the interview process if you know what I mean.
c.  There is a very specific area of development that I am looking for
and I think these people can be filtered out by using the following
criteria:
i.  If Mono experience is the first hurdle, then someone that has
experience with the ‘Mono Tools for Visual Studio’ is the next
hurdle.  FM is a Microsoft house.  Meaning, the vast majority of
software development is done within Microsoft Visual Studio, which in
turn is why FM has chosen to use this plug-in for Visual Studio.
ii. If you can find someone that has used the plug-in, that is great.
The reason why is because we really want someone that has used the
‘Debug Remotely on Linux’ feature of the ‘Mono Tools for Visual
Studio’ because this is vital for our SuSE Linux development.

If interested, please send across your most updated resume along with
your expected hourly pay rate at your earliest convenience.

Please feel free to contact me.

Thanks & Regards,

Suganthi Vincent
510 405-1134 (Direct Line)
sugant...@metabyte.com
www.metabyte.com

Join me at http://www.linkedin.com/in/suganthivincent

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


Re: expat parsing error

2010-06-01 Thread John Machin
On Jun 2, 1:57 am, "kak...@gmail.com"  wrote:
> On Jun 1, 11:12 am, "kak...@gmail.com"  wrote:
>
>
>
> > On Jun 1, 11:09 am, John Bokma  wrote:
>
> > > "kak...@gmail.com"  writes:
> > > > On Jun 1, 10:34 am, Stefan Behnel  wrote:
> > > >> kak...@gmail.com, 01.06.2010 16:00:
>
> > > >> > how can i fix it, how to "ignore" the headers and parse only
> > > >> > the XML?
>
> > > >> Consider reading the answers you got in the last thread that you opened
> > > >> with exactly this question.
>
> > > >> Stefan
>
> > > > That's exactly, what i did but something seems to not working with the
> > > > solutions i had, when i changed my implementation from pure Python's
> > > > sockets to twisted library!
> > > > That's the reason i have created a new post!
> > > > Any ideas why this happened?
>
> > > As I already explained: if you send your headers as well to any XML
> > > parser it will choke on those, because the headers are /not/ valid /
> > > well-formed XML. The solution is to remove the headers from your
> > > data. As I explained before: headers are followed by one empty
> > > line. Just remove lines up and until including the empty line, and pass
> > > the data to any XML parser.
>
> > > --
> > > John Bokma                                                               
> > > j3b
>
> > > Hacking & Hiking in Mexico -  
> > > http://johnbokma.com/http://castleamber.com/-Perl&; Python Development
>
> > Thank you so much i'll try it!
> > Antonis
>
> Dear John can you provide me a simple working solution?
> I don't seem to get it

You're not wrong. Trysomething like this:

rubbish1, rubbish2, xml = your_guff.partition('\n\n')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to generate a csr in python?

2010-06-01 Thread holmes86
On Jun 1, 3:46 pm, Peter Otten <__pete...@web.de> wrote:
> holmes86 wrote:
> > On May 31, 7:37 pm, holmes86  wrote:
> >> hi,everyone
>
> >> I want generate a Certificate signing request in python,but I don't
> >> how to realize this function.I don't find any method after read the
> >> python-openssl manual.Any help will appreciate.
>
> > nobody?
>
> Is the createCertRequest() function at
>
> http://bazaar.launchpad.net/~exarkun/pyopenssl/trunk/annotate/head:/e...
>
> what you're looking for?
>
> Peter

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


Re: Challenging Job Opportunity for a C# Architect/ Developer

2010-06-01 Thread rzzzwilson
http://www.catb.org/~esr/faqs/smart-questions.html#forum
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Vote to Add Python Package "pubsub" to the Python Standard Library

2010-06-01 Thread Carl Banks
On May 26, 4:26 am, Tom  wrote:
> I vote for adding the Python package "pubsub" to the Python standard
> library.  It has recently been added to wxpython (replacing the old
> wx.lib.pubsub package), but it has application to non-gui programs as
> well.


Well, I can definitely see a case for adding something like this to
the standard library.  If there is a standard publish-subscribe
implementation, then different third-party packages can use it in a
consistent way together.  It can open whole paradigms of package
integration.

However, I'm not sure this particular library is the one to use, and I
would not be in favor of throwing the first publish-subscribe
implentation that comes by into the standard library, at least not
without a whole lot of vetting first.  (They did that with optparse
and the Python community has been paying for it ever since.)

I think it has a pretty good chance of being accepted, too.  The
publish-subscribe pattern, if you will, seems to have been implemented
separately in many places.  The logging module in the standard library
uses something like this.  Qt's signal/slot mechanism is another
variation.  I'm sure there's lots more.  I've noticed that pointing
out lots of independetnly crafted examples in the wild, and especially
in the standard library, works quite well.


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


Re: Challenging Job Opportunity for a C# Architect/ Developer

2010-06-01 Thread Albert Hopkins
On Tue, 2010-06-01 at 19:44 -0700, rzzzwilson wrote:
> http://www.catb.org/~esr/faqs/smart-questions.html#forum

werd.

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


Converting a pickle to python3

2010-06-01 Thread Paulo da Silva
Hi!

I have a big data structure cpickled into a datafile, by python2.
I tried to unpickle it using python3 but got the followin message:
File "/usr/lib64/python3.1/pickle.py", line 1372, in loads
encoding=encoding, errors=errors).load()
_pickle.UnpicklingError: invalid load key, 'x'.

Is there a way to "stream" a class in python2 and then get it back in
python3?

Thanks for any help/comments.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Vote to Add Python Package "pubsub" to the Python Standard Library

2010-06-01 Thread Daniel Fetchinson
> I vote for adding the Python package "pubsub" to the Python standard
> library.  It has recently been added to wxpython (replacing the old
> wx.lib.pubsub package), but it has application to non-gui programs as
> well.
>
> For more information see: .

If you are really interested in this the minimum would be following these steps:

1. discuss various publish-subscribe API variants on python-list (aka c.l.p)
2. when you got tons of feedback summarize the discussion on python-dev
3. tons of feedback will follow and try to converge on a consensus
concerning the API
4. write a PEP
5. produce an implementation (or get someone to do it)
6. add the implementation to the PEP
7. lobby for acceptance of the PEP

A good example for the first couple of stages of this process is PEP
3143 concerning adding a daemon package to the stdlib:
http://www.python.org/dev/peps/pep-3143/

I haven't found the beginning of the thread discussing this but you
can start for example here:

http://mail.python.org/pipermail/python-list/2009-March/1197808.html

Good luck,
Daniel


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
http://mail.python.org/mailman/listinfo/python-list


plac, the easiest command line arguments parser in the world

2010-06-01 Thread Michele Simionato
I would like to announce to the world the first public release of
plac:

  http://pypi.python.org/pypi/plac

Plac is a wrapper over argparse and works in all versions of
Python starting from Python 2.3 up to Python 3.1.

With blatant immodesty, plac claims to be the easiest to use command
line arguments parser module in the Python world. Its goal is to
reduce the
learning curve of argparse from hours to minutes. It does so by
removing the need to build a command line arguments parser by hand:
actually it is smart enough to infer the parser from function
annotations.

Here is a simple example (in Python 3) to wet your appetite:

$ cat example.py
def main(arg: "required argument"):
"do something with arg"
print('Got %s' % arg)

if __name__ == '__main__':
import plac; plac.call(main) # passes sys.argv[1:] to main

$ python example.py -h
usage: example.py [-h] arg

do something with arg

positional arguments:
  arg required argument

optional arguments:
  -h, --help  show this help message and exit


$ python example.py
usage: example.py [-h] arg
example.py: error: too few arguments

$  python example.py arg
Got arg

$  python example.py arg1 arg2
usage: example.py [-h] arg
example.py: error: unrecognized arguments: arg2

You can find in the documentation a lot of other simple and not so
simple
examples:

  http://micheles.googlecode.com/hg/plac/doc/plac.html


Enjoy!

 Michele Simionato

P.S. answering an unspoken question: yes, we really needed yet
another
command line arguments parser! ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs. Fedora and CentOS

2010-06-01 Thread John Nagle

Michael Torrie wrote:

On 05/31/2010 05:13 AM, Jason D wrote:
There is however never been an issue to locate different version of python 
in your system as you deem fit without problems. 
So I dont understand why your concern.


Actually, replacing python on RHEL is a major endeavor.  Almost all Red
Hat utilities are written in python and depend on the specific system
version of python that they shipped.  Thus if you want to upgrade python
you're going to break 80% of the system.

Sure you can install Python from source alongside the system python, but
that's a maintenance nightmare for system administrators.  


   There's something to be said for having all versions of Python installed
as "python2.4", "python2.6", "python3.1", etc., with the name "python"
simply being a link to the favored version.   Maybe that should be
the default.  The Python Windows installers already work that way; they
create "\python26", etc. directories.  The Linux installers, by
default, want to install as "python".

   Add-on RPMs should be set up for versioned install. Then you can
safely install alternate versions.  I gather that "iuscommunity.org" 
distributions do something like this.


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


signed vs unsigned int

2010-06-01 Thread johnty
i'm reading bytes from a serial port, and storing it into an array.

each byte represents a signed 8-bit int.

currently, the code i'm looking at converts them to an unsigned int by
doing ord(array[i]). however, what i'd like is to get the _signed_
integer value. whats the easiest way to do this?

thanks in advance.

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