Re: Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread Kushal Kumaran
On Thu, Jun 14, 2012 at 6:35 AM, Daniel Klein wrote: > The windows box is my development box, it's not where the script will be > running in the end. It'll be running on a Linux box where I don't have root > so python setup.py install isn't an option (to my understanding). > You might want to u

Re: string to list

2012-06-13 Thread Ian Kelly
On Wed, Jun 13, 2012 at 10:06 PM, Jose H. Martinez wrote: > string.split(',') will give you an array. > > Example: > > 'AAA,",,",EEE,FFF,GGG '.split(',') > > ['AAA', '"', '', '"', 'EEE', 'FFF', 'GGG'] But it incorrectly splits the quoted part. A proper CSV parser (like th

Re: Internationalized domain names not working with URLopen

2012-06-13 Thread John Nagle
On 6/12/2012 11:42 PM, Andrew Berg wrote: On 6/13/2012 1:17 AM, John Nagle wrote: What does "urllib2" want? Percent escapes? Punycode? Looks like Punycode is the correct answer: https://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_ToUnicode I haven't tried it, though.

Re: string to list

2012-06-13 Thread Jose H. Martinez
string.split(',') will give you an array. Example: 'AAA,",,",EEE,FFF,GGG '.split(',') ['AAA', '"', '', '"', 'EEE', 'FFF', 'GGG'] On Wed, Jun 13, 2012 at 10:53 PM, Chris Rebert wrote: > n Wed, Jun 13, 2012 at 7:29 PM, bruce g wrote: > > What is the best way to parse a

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Terry Reedy
On 6/13/2012 6:45 PM, Gilles wrote: On Wed, 13 Jun 2012 23:16:31 +0200, Christian Heimes wrote: PHP was developed for non-developers. (see http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ ). It's much easier and also cheaper to find bad coders and non-developers than code peop

Re: string to list

2012-06-13 Thread Chris Rebert
n Wed, Jun 13, 2012 at 7:29 PM, bruce g wrote: > What is the best way to parse a CSV string to a list? Use the `csv` module: http://docs.python.org/library/csv.html http://www.doughellmann.com/PyMOTW/csv/ The `StringIO` module can be used to wrap your string as a file-like object for consumption

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Tim Chase
On 06/13/12 17:44, Gilles wrote: > On 13 Jun 2012 22:16:51 GMT, Steven D'Aprano > wrote: >> Surely the obvious answer is that a framework offers the benefit that you >> don't have to write the application from scratch. > > Yes, but between receiving the query and sending the response, what > fea

Re: Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread Daniel Klein
The windows box is my development box, it's not where the script will be running in the end. It'll be running on a Linux box where I don't have root so python setup.py install isn't an option (to my understanding). So what happened is that 7zip didn't unzip the .tar.gz2 properly, but it does fi

RE: [newbie] Equivalent to PHP?

2012-06-13 Thread Prasad, Ramit
> Indeed, but with so much criticism about PHP, it's odd that they would > still choose it. Could be a familiarity/ease issue as it was originally started by a college student (and college students seldom have meaningful real world experience) before it exploded in size. Also do not forget that

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Steven D'Aprano
On Thu, 14 Jun 2012 00:44:23 +0200, Gilles wrote: > On 13 Jun 2012 22:16:51 GMT, Steven D'Aprano > wrote: >>Surely the obvious answer is that a framework offers the benefit that >>you don't have to write the application from scratch. > > Yes, but between receiving the query and sending the respo

consecutive node sequence and pathlength problem using networkx graph

2012-06-13 Thread bob
Let say,I have a conjugated cyclic polygon and its nodes are given by the list: list_p=[a,b,c,d,e,f,g,a,a,b,d,d,d,d,d,c,c,e,e,a,d,d,g]. If X & Y are any elements in a list_p except d, and Z is also an element of list_p but has value only d, i.e, Z=d. Now,I want to compute the number of

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 23:12:37 +, "Prasad, Ramit" wrote: >You are not Facebook (at least yet). Indeed, but with so much criticism about PHP, it's odd that they would still choose it. Anyway, thanks much for the infos. I'll look at the web frameworks and how to connect the Python app to a front

RE: When adding my application to Windows right-click menu

2012-06-13 Thread Prasad, Ramit
> I made a cipher app but to make easy, I want to make it Windows > rightclick menu can execute it > I found the way with dealing with Registry > > > [HKEY_CLASSES_ROOT\Directory\Background\shell\app] > [HKEY_CLASSES_ROOT\Directory\Background\shell\app\command] > @="C;\myapp filelocation" > >

RE: [newbie] Equivalent to PHP?

2012-06-13 Thread Prasad, Ramit
> >PHP was developed for non-developers. (see > >http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ ). > >It's much easier and also cheaper to find bad coders and non-developers > >than code people. The outcome is bad performance and lots of security > >issues. > > And as to why Fac

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 23:16:31 +0200, Christian Heimes wrote: >PHP was developed for non-developers. (see >http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ ). >It's much easier and also cheaper to find bad coders and non-developers >than code people. The outcome is bad performance a

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On 13 Jun 2012 22:16:51 GMT, Steven D'Aprano wrote: >Surely the obvious answer is that a framework offers the benefit that you >don't have to write the application from scratch. Yes, but between receiving the query and sending the response, what features do frameworks offer that I'd have to writ

When adding my application to Windows right-click menu

2012-06-13 Thread Yesterday Paid
I made a cipher app but to make easy, I want to make it Windows rightclick menu can execute it I found the way with dealing with Registry [HKEY_CLASSES_ROOT\Directory\Background\shell\app] [HKEY_CLASSES_ROOT\Directory\Background\shell\app\command] @="C;\myapp filelocation" but I don't know ho

RE: Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread Prasad, Ramit
> There indeed seems to be something wrong with my installation of pytz. I had a > look around the zoneinfo dir, which is where build_tzinfo polls its info from, > and a whole bunch of files are 0 bytes. Whenever I try to instantiate a > timezone whose corresponding file is 0 bytes I get that error

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Steven D'Aprano
On Wed, 13 Jun 2012 12:17:12 +0200, Gilles wrote: > Thanks for the longer explanation. With so many frameworks, I'd like to > know what benefits they offer as compared to writing an application from > scratch Surely the obvious answer is that a framework offers the benefit that you don't have to

Re: Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread bringa
Thanks Terry! There indeed seems to be something wrong with my installation of pytz. I had a look around the zoneinfo dir, which is where build_tzinfo polls its info from, and a whole bunch of files are 0 bytes. Whenever I try to instantiate a timezone whose corresponding file is 0 bytes I get

Re: Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread Terry Reedy
On 6/13/2012 4:55 PM, bri...@gmail.com wrote: Hi! I'm trying to get a handle on pytz (http://pytz.sourceforge.net/). I don't have root on the system I'll be running my script on, so I need to go for a local installation. I copied pytz into a folder in my sys.path and am importing from there.

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Christian Heimes
Am 13.06.2012 22:48, schrieb Gilles: > On Wed, 13 Jun 2012 17:27:21 +0200, Christian Heimes > wrote: >> A long running process has lots of benefits that makes design and >> development easier and makes your app faster. > > Thanks much for the infos. Makes you wonder why commercial companies > sti

Pytz error: unpack requires a string argument of length 44

2012-06-13 Thread bringa
Hi! I'm trying to get a handle on pytz (http://pytz.sourceforge.net/). I don't have root on the system I'll be running my script on, so I need to go for a local installation. I copied pytz into a folder in my sys.path and am importing from there. That part seems to work. I downloaded the tarbal

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 17:27:21 +0200, Christian Heimes wrote: >A long running process has lots of benefits that makes design and >development easier and makes your app faster. Thanks much for the infos. Makes you wonder why commercial companies still choose PHP to write their web site. -- http://m

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 18:01:23 +, "Prasad, Ramit" wrote: >Maybe this article will help you >http://www.infoworld.com/d/application-development/pillars-python-six-python-web-frameworks-compared-169442 >The comments on /. should round out anything missing from the article (I hope) >http://develop

Re: network protocols

2012-06-13 Thread Tarek Ziadé
On 6/13/12 8:33 PM, Christian Heimes wrote: Am 13.06.2012 16:56, schrieb Christian Heimes: Am 13.06.2012 13:41, schrieb Tarek Ziadé: Hey I was surprised not to find any way to list all protocol names listed in /etc/protocols in Python We have socket.getprotobyname(NAME) But there's no way t

Re: network protocols

2012-06-13 Thread Christian Heimes
Am 13.06.2012 16:56, schrieb Christian Heimes: > Am 13.06.2012 13:41, schrieb Tarek Ziadé: >> Hey >> >> I was surprised not to find any way to list all protocol names listed in >> /etc/protocols in Python >> >> We have >> >> socket.getprotobyname(NAME) >> >> But there's no way to get the list of na

Re: which one do you prefer? python with C# or java?

2012-06-13 Thread Tomasz Rola
On Tue, 12 Jun 2012, Tim Johnson wrote: > I concur, I worked in C and C++ for 12 years. I added C++ later in > my programming life. I don't recommend C++ for single programmers. > - that is to say - 1 coder for 1 codebase. One can do good enough > OOP in ansi C believe it or not, I learned

RE: [newbie] Equivalent to PHP?

2012-06-13 Thread Prasad, Ramit
> Thanks for the longer explanation. With so many frameworks, I'd like > to know what benefits they offer as compared to writing an application > from scratch, and if they do offer obvious benefits, which one to pick I am going to state up front that I have never tried any of the frameworks so ta

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Grant Edwards
On 2012-06-13, Steven D'Aprano wrote: > On Tue, 12 Jun 2012 12:36:36 +0200, Gilles wrote: > >> I enjoy writing scripts in Python much more than PHP, but with so many >> sites written in PHP, I need to know what major benefits there are in >> choosing Python (or Ruby, ie. not PHP). > > The main ben

Re: validating XML

2012-06-13 Thread Stefan Behnel
andrea crotti, 13.06.2012 12:06: > Hello Python friends, I have to validate some xml files against some xsd > schema files, but I can't use any cool library as libxml unfortunately. Any reason for that? Because the canonical answer to your question would be lxml, which uses libxml2. Stefan -- h

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-13 Thread rdsteph
> I think this is the wave of the furture for deploying simple programs > to many users. It is almost 100% cross platform (can be used on > desktop, smartphone, tablet, windows, linux, mac etc) and is very easy > to do, even for casual "non-programmers" who do a little programming > (such as many e

Re: validating XML

2012-06-13 Thread Dieter Maurer
andrea crotti writes: > Hello Python friends, I have to validate some xml files against some xsd > schema files, but I can't use any cool library as libxml unfortunately. Why? It seems not very rational to implement a complex task (such as XML-Schema validation) when there are ready solutions ar

Re: validating XML

2012-06-13 Thread andrea crotti
So as far as I understood what I should do is the following. Go through my own XML keeping track of the full path of everything for example and so on, then for every entry found in this iteration, check the schema to make sure that that particular construct is allowed on that level of the tree

Re: Internationalized domain names not working with URLopen

2012-06-13 Thread Hemanth H.M
My bad, it worked; need to avoid http:// along with snowman, before encode. On Wed, Jun 13, 2012 at 9:02 PM, Hemanth H.M wrote: > Well not really! does not work with '☃.net' > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.6/urllib2.py", line 126, in url

Re: Internationalized domain names not working with URLopen

2012-06-13 Thread Hemanth H.M
Well not really! does not work with '☃.net' Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.6/urllib2.py", line 391, in open response = self._open(req, da

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Christian Heimes
Am 12.06.2012 11:39, schrieb Gilles: > I notice that Python-based solutions are usually built as long-running > processes with their own web server (or can run in the back with eg. > Nginx and be reached through eg. FastCGI/WSGI ) while PHP is simply a > language to write scripts and requires a web

Re: network protocols

2012-06-13 Thread Christian Heimes
Am 13.06.2012 13:41, schrieb Tarek Ziadé: > Hey > > I was surprised not to find any way to list all protocol names listed in > /etc/protocols in Python > > We have > > socket.getprotobyname(NAME) > > But there's no way to get the list of names > > Any ideas if this is available in the stdlib s

Re: network protocols

2012-06-13 Thread Verde Denim
On 6/13/12, John Sutterfield wrote: > > Tarek, > > There doesn't appear to be a function in stdlib to cover that particular > case. > > Doug Hellman has a nice section on finding service info here: > > http://www.doughellmann.com/PyMOTW/socket/addressing.html > > It wouldn't be "built-in", but it

Re: Ann: New Stackless Website

2012-06-13 Thread Peter Funk
Christian Tismer wrote on monday, 11.06.2012 at 19:01: ... > Stackless Python has a New Website ... > Due to a great effort of the Nagare people: > > http://www.nagare.org/ > > and namely by the tremendous work of Alain Pourier, > > Stackless Python has now a new website! > > This is no lon

RE: network protocols

2012-06-13 Thread John Sutterfield
Tarek, There doesn't appear to be a function in stdlib to cover that particular case. Doug Hellman has a nice section on finding service info here: http://www.doughellmann.com/PyMOTW/socket/addressing.html It wouldn't be "built-in", but it looks like it would be pretty simple to get the in

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-13 Thread Wolfgang Keller
> No matter how cool it may seem to create simple GUIs manually or to > write business letters using LaTeX: just try to persuade people to > move from Word to LaTeX for business letters... Good example. I have done nearly exactly this* - but it was only possible thanks to LyX. Sincerely, Wolfga

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-13 Thread Wolfgang Keller
> > Tkinter is imho honestly the very best "argument" if you want to > > make potential new users turn their backs away from Python for > > good. Just show them one GUI implemented with it and, hey, wait, > > where are you running to... > > Yes, Tkinter GUI's are very ugly. > > http://www.codebyk

Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)

2012-06-13 Thread Wolfgang Keller
> > * Domain experts in fact who would need to implement loads of > > software to help them get their work done but can't. And since > > there's no budget for external developers, nothing get's ever done > > about this. > Well, typically or at least very often sooner or later something > gets done

network protocols

2012-06-13 Thread Tarek Ziadé
Hey I was surprised not to find any way to list all protocol names listed in /etc/protocols in Python We have socket.getprotobyname(NAME) But there's no way to get the list of names Any ideas if this is available in the stdlib somehwere ? Thx Tarek -- http://mail.python.org/mailman/listinf

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 20:00:59 +1000, Chris Angelico wrote: >Most high level languages probably have some sort of HTTP server >available. Some make it trivially easy to plug some code in and start >serving. Python is advertised as "batteries included", and one of its >packets of batteries is a fairl

validating XML

2012-06-13 Thread andrea crotti
Hello Python friends, I have to validate some xml files against some xsd schema files, but I can't use any cool library as libxml unfortunately. A Python-only validator might be also fine, but all the projects I've seen are partial or seem dead.. So since we define the schema ourselves, I was all

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Chris Angelico
On Wed, Jun 13, 2012 at 7:49 PM, Gilles wrote: > On Wed, 13 Jun 2012 19:41:41 +1000, Chris Angelico > wrote: >>For high-availability servers, I can't speak for Python, as I've never >>done that there; but it seems likely that there's good facilities. My >>personal preference is Pike, but that's o

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 19:41:41 +1000, Chris Angelico wrote: >For high-availability servers, I can't speak for Python, as I've never >done that there; but it seems likely that there's good facilities. My >personal preference is Pike, but that's off-topic for this list. :) >But the simple answer for s

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Chris Angelico
On Wed, Jun 13, 2012 at 7:25 PM, Gilles wrote: > I have a couple more questions: > > 1. Today what is the recommended way to connect a long-running Python > web application with a web server running in the front? FastCGI? WSGI? > Other? > > 2. Which solid web server is recommended to connect to Py

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Tue, 12 Jun 2012 16:48:27 +0200, Matej Cepl wrote: >I don't think it is a proper description of the situation (please, >somebody correct my mistakes, I am not 100% sure about it myself). WSGI >applications (which is basically all web applications in Python) could >run in the hosted servers (

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On 13 Jun 2012 08:29:05 GMT, Steven D'Aprano wrote: >http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ > >and especially lack PHP's security vulnerabilities. Thanks for the link. -- http://mail.python.org/mailman/listinfo/python-list

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Gilles
On Wed, 13 Jun 2012 10:19:29 +1000, Chris Angelico wrote: >It's far simpler to manage, it retains running state, and is easily >enough encapsulated. It's the non-magic way of doing things. Also, it >plays very nicely with the MUD style of process, which is something I >do a lot with Pike. Plus, if

Re: multiprocessing: excepthook not getting called

2012-06-13 Thread Philipp Hagemeister
On 06/13/2012 11:00 AM, Dave Cook wrote: > Originally, I was trying to send formatted > tracebacks back to the main process on a queue. You can still do that: import multiprocessing import sys def queueErrors(q): def decorator(func): def wrapped(*args, **kwargs): try:

Re: multiprocessing: excepthook not getting called

2012-06-13 Thread Philipp Hagemeister
multiprocessing just mimicks the threading module here, see http://bugs.python.org/issue1230540 . Why do you need excepthook in the first place? You can perfectly simulate it by wrapping the root method (target in your example) in a try .. catch: import multiprocessing import sys def printErrors

Re: [newbie] Equivalent to PHP?

2012-06-13 Thread Steven D'Aprano
On Tue, 12 Jun 2012 12:36:36 +0200, Gilles wrote: > I enjoy writing scripts in Python much more than PHP, but with so many > sites written in PHP, I need to know what major benefits there are in > choosing Python (or Ruby, ie. not PHP). The main benefit is that they are not PHP. http://me.veekun

Re: Using pdb with greenlet?

2012-06-13 Thread Dieter Maurer
Salman Malik writes: > I am sort of a newbie to Python ( have just started to use pdb). > My problem is that I am debugging an application that uses greenlets and when > I encounter something in code that spawns the coroutines or wait for an event, > I lose control over the application (I mean th