Re: do_POST not working on http.server with python

2016-05-01 Thread Pierre Quentel
Le jeudi 28 avril 2016 10:36:27 UTC+2, Rahul Raghunath a écrit : > 0 > down vote > favorite > > > I'm trying to create a simple http server with basic GET and POST > functionality. The program is supposed to GET requests by printing out a > simple webpage that greets a user and askes how

Re: how to setup for localhost:8000

2016-04-17 Thread Pierre Quentel
> > 127.0.0.1 - - [15/Apr/2016 20:57:32] "GET / HTTP/1.1" 200 - > Hi Pierre, > > When I type http://localhost:8000, I did not see anything in the console > after the line "Serving HTTP on 0.0.0.0 port 8000 ... I believe the way I ran > was not correct as shown below: > > python -m http.server

Re: how to setup for localhost:8000

2016-04-15 Thread Pierre Quentel
Le jeudi 14 avril 2016 22:50:33 UTC+2, wrh...@gmail.com a écrit : > On Thursday, April 14, 2016 at 2:23:36 PM UTC-4, Andrew Farrell wrote: > > What happens when you type > > > > http://localhost:8000 > > > > Into the address bar of your browser as this is running? > > > > On Thu, Apr 14, 2016 at

Re: Iterators membership testing

2015-08-09 Thread Pierre Quentel
> The trap you're seeing here is that iterating over an iterator always > consumes it, but mentally, you're expecting this to be iterating over > a new instance of the same sequence. No, I just tried to apply what I read in the docs : 1. I have y = A(10) which is an instance of a class which doe

Re: Iterators membership testing

2015-08-09 Thread Pierre Quentel
Le dimanche 9 août 2015 11:25:17 UTC+2, Chris Angelico a écrit : > On Sun, Aug 9, 2015 at 7:06 PM, Pierre Quentel > wrote: > > "For user-defined classes which do not define __contains__() but do define > > __iter__(), x in y is true if some value z with x == z is produ

Iterators membership testing

2015-08-09 Thread Pierre Quentel
The documentation at https://docs.python.org/3.5/reference/expressions.html#not-in says : "For user-defined classes which do not define __contains__() but do define __iter__(), x in y is true if some value z with x == z is produced while iterating over y. If an exception is raised during the it

[ANN] Brython 3.0.0 relased

2014-11-16 Thread Pierre Quentel
Hi, Version 3.0.0 of Brython has been released recently Brython is an implementation of Python 3 running in the browser, with an interface to DOM elements and events. It allows writing web client applications with Python instead of Javascript. Python programs are inserted in the HTML page insi

Re: Problem with the console on the new python.org site

2014-02-24 Thread Pierre Quentel
Le lundi 24 février 2014 14:19:12 UTC+1, Jean-Michel Pichavant a écrit : > - Original Message - > > On Sun, 23 Feb 2014 10:20:15 -0800, Pierre Quentel wrote: > > > > > The new home page of python.org is very nice, congratulations ! > > > > The

Problem with the console on the new python.org site

2014-02-23 Thread Pierre Quentel
The new home page of python.org is very nice, congratulations ! But there is a problem with the online console provided by PythonAnywhere : with my azerty keyboard, I can't enter characters such as ) or ] - very annoying ! It this going to be fixed soon ? - Pierre -- https://mail.python.org/m

Re: Brython (Python in the browser)

2013-12-27 Thread Pierre Quentel
Le vendredi 27 décembre 2013 17:12:09 UTC+1, Johannes Schneider a écrit : > On 27.12.2013 07:14, Pierre Quentel wrote: > > > Hi, > > > > > > Ever wanted to use Python instead of Javascript for web client programming > > ? Take a look at Brython, an imple

Re: Brython (Python in the browser)

2013-12-27 Thread Pierre Quentel
Le vendredi 27 décembre 2013 15:56:33 UTC+1, jonas.t...@gmail.com a écrit : > Den fredagen den 27:e december 2013 kl. 07:14:35 UTC+1 skrev Pierre Quentel: > > > Hi, > > > > > > > > > > > > Ever wanted to use Python instead of Javascript

Brython (Python in the browser)

2013-12-26 Thread Pierre Quentel
Hi, Ever wanted to use Python instead of Javascript for web client programming ? Take a look at Brython, an implementation of Python 3 in the browser, with an interface with DOM elements and events Its use is very simple : - load the Javascript library brython.js :

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
I forgot to mention : list comprehensions and the ternary operator (r1 if cond else r2) are now supported ! - Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
> Still, it tends to be a lot harder to explain, document, and read > documentation for, something that uses operators weirdly, rather than > keyword-searchable method names. You don't explain how to use the Python syntax (for instance the operator %, which behaves very differently between intege

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
I was over-simplifying - or, to put is less diplomatically, I screwed up - when I answered that the addition returned a string. As Chris pointed out, it made the explanation very confusing. My apologies The objects handled by + and <= can be : - strings, integers, floats - instances of $TagClass

Re: Brython - Python in the browser

2012-12-22 Thread Pierre Quentel
> Oh, and repr is just a synonym of str, which makes it useless. 3 days ago repr was not even implemented at all, so it's a step forward... -- http://mail.python.org/mailman/listinfo/python-list

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> The interpreter, though, will be more than happy to treat that as a > comparison if the LHS is not the type that you think it is. For > example, maybe you've added it to a string at some point, and now it's > a string instead of an element. I guess that since doc is made a > keyword, that proba

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> Hmm. So when that gets added into a DIV, it has to get parsed for > tags? How does this work? This seems very odd. I would have expected > it to remain as DOM objects. In DIV(child) : - if child is a string, integer or float, a text node is added (addChild) to the DIV element, with the string

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> <= is a comparison expression operator, which is completely different. > It is just wrong for this usage. I am 99.9% sure you will come to regret > it eventually. Better to make the change now than in Brython2 or Brython3. I am 99.99% sure of the contrary, having used this syntax for more than

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> Pythonic also means: > If the implementation is hard to explain, it's a bad idea. > What, exactly, does the sum of a string and a bolded string produce? Can you > explain that easily and clearly? Yes : a+b returns the string a+str(b) It is exactly what you get in CPython with >>> class B: ..

Re: Brython - Python in the browser

2012-12-21 Thread Pierre Quentel
> If that's your intention, then instead of coming up with something totally > new, unpythonic and ugly, why not take the normal Python route and > implement a subset of the ElementTree API? > > Stefan Because the tree implementation in ElementTree or other tree modules in Python require a lot of

Re: Brython - Python in the browser

2012-12-20 Thread Pierre Quentel
Le jeudi 20 décembre 2012 01:54:44 UTC+1, Ian a écrit : > On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: > > > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I > > > don't think any browser support5 all of that moving target, and Gecko > > > apparently supports a

Re: Brython - Python in the browser

2012-12-20 Thread Pierre Quentel
Le jeudi 20 décembre 2012 01:07:15 UTC+1, Terry Reedy a écrit : > On 12/19/2012 1:19 PM, Pierre Quentel wrote: > > > > > The objective of Brython is to replace Javascript by Python as the > > > scripting language for web browsers, making it usable on all > >

Brython - Python in the browser

2012-12-19 Thread Pierre Quentel
Hi, The objective of Brython is to replace Javascript by Python as the scripting language for web browsers, making it usable on all terminals including smartphones, tablets, connected TVs, etc. Please forgive the lack of ambition ;-) The best introduction is to visit the Brython site (http://w

[ANN] Karrigell-4.3.6 released

2011-10-31 Thread Pierre Quentel
Hi, A new version of the Karrigell web framework for Python 3.2+ has just been released on http://code.google.com/p/karrigell/ One of the oldest Python web frameworks around (the first version was released back in 2002), it now has 2 main versions, one for Python 2 and another one for Python 3. T

Re: Relative seeks on string IO

2011-09-07 Thread Pierre Quentel
> > Please post code without non-code indents, like so: > Sorry about that. After the line "Example :" I indented the next block, out of habit ;-) > > What system are you using? Does it have a narrow or wide unicode build? > (IE, what is the value of sys.maxunicode?) > I use Windows XP Pro, version

Relative seeks on string IO

2011-09-06 Thread Pierre Quentel
Hi, I am wondering why relative seeks fail on string IO in Python 3.2 Example : from io import StringIO txt = StringIO('Favourite Worst Nightmare') txt.seek(8) # no problem with absolute seek but txt.seek(2,1) # 2 characters from current position raises "IOError: Can't do nonz

Re: Crazy what-if idea for function/method calling syntax

2011-07-18 Thread Pierre Quentel
On 18 juil, 07:54, Steven D'Aprano wrote: > On Mon, 18 Jul 2011 08:54 am ΤΖΩΤΖΙΟΥ wrote: > > > Jumping in: > > > What if a construct > > >    xx(*args1, **kwargs1)yy(*args2, **kwargs2) > > > was interpreted as > > >   xxyy(*(args1+args2), **(kwargs1+kwargs2)) > > > (Note: with **(kwargs1+kwargs2)

Re: Python Forum

2010-06-04 Thread Pierre Quentel
On 4 juin, 07:11, Steven D'Aprano wrote: > On Thu, 03 Jun 2010 03:16:03 -0700, Pierre Quentel wrote: > > So the OP's initiative should be an incentive to think on the format of > > the interaction between all the range of Python users, from newbees to > > gurus. We

Re: Python Forum

2010-06-03 Thread Pierre Quentel
On 3 juin, 10:57, Ben Finney wrote: > News123 writes: > > However, whether we like it or not: > > Fewer and fewer newcomers are willing, knowledgable, aware of nntp > > If so, isn't that an indication that better education about the benefits > is required? Perhaps in combination with improving th

Re: Simple Cookie Script: Not recognising Cookie

2010-04-08 Thread Pierre Quentel
On 8 avr, 07:03, Jimbo wrote: > Hi I have a simple Python program that assigns a cookie to a web user > when they open the script the 1st time(in an internet browser). If > they open the script a second time the script should display the line > " You have been here 2 times." , if they open the scr

Re: Python script error when using print

2010-04-06 Thread Pierre Quentel
On 6 avr, 20:14, "Albert W. Hopkins" wrote: > On Tue, 2010-04-06 at 08:38 -0700, Robbie wrote: > > Hi all, > > > So, I'm trying to use Python with an apache2 server to create some web > > pages.  The web server is configured and seems to work correctly, but > > only with a certain type of script.

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Pierre Quentel
On 30 mar, 21:19, John Bokma wrote: > Robert Fendt writes: > > In fact, the syntax just shouts 'do [...] unless' to me. And > > that's so strong a Perl-ism I cannot quite express how ugly I > > actually find it... > > And > >  a == b and 'Yes' or 'No' > > isn't a Perl-ism? > > Sheesh, this group

Re: Karrigell 3.0.4 published

2010-02-27 Thread Pierre Quentel
On 27 fév, 08:57, Pierre Quentel wrote: > Hi, > > A new version of the web framework Karrigell is on line > > The main changes are : > - more robust session management in multi-threaded and multi-process > environments > - Unicode management in the HTMLTags module (HTM

Karrigell 3.0.4 published

2010-02-27 Thread Pierre Quentel
Hi, A new version of the web framework Karrigell is on line The main changes are : - more robust session management in multi-threaded and multi-process environments - Unicode management in the HTMLTags module (HTML generation in Python) - Unicode management and error reports in Karrigell Template

Re: Dynamic HTML controls

2010-01-12 Thread Pierre Quentel
On 12 jan, 04:26, Alan Harris-Reid wrote: > Hi, > > Does anyone know where I can find any decent dynamically-constructed > HTML control classes (dropdown list, table, input field, checkbox, etc.) > written in Python.  For example, for a HTML table I would like something > like... > > MyTable = htm

Re: select lines in python

2009-07-15 Thread Pierre Quentel
On 14 juil, 19:33, amr...@iisermohali.ac.in wrote: > Dear all, > > Can anyone tell me that suppose i have a file having content like: > >     _Atom_name >       _Atom_type >       _Chem_shift_value >       _Chem_shift_value_error >       _Chem_shift_ambiguity_code >      1     1   PHE       H     H

Re: fastest native python database?

2009-06-18 Thread Pierre Quentel
On 18 juin, 05:28, per wrote: > hi all, > > i'm looking for a native python package to run a very simple data > base. i was originally using cpickle with dictionaries for my problem, > but i was making dictionaries out of very large text files (around > 1000MB in size) and pickling was simply too

Re: BaseHttpServer

2009-02-15 Thread Pierre Quentel
On 15 fév, 18:31, Paul wrote: > Hi, > I currently have a webserver using BaseHttpServe that serves images > like this: > if self.path.endswith(".jpg"): >                 print(curdir + sep + self.path) >                 f = open(curdir + sep + self.path,"b") >                 self.send_response(20

Re: SQL, lite lite lite

2008-12-29 Thread Pierre Quentel
On 29 déc, 19:06, Aaron Brady wrote: > Hi all, > > About a year ago, I posted an idea I was having about thread > synchronization to the newsgroup.  However, I did not explain it well, > and I really erred on the side of brevity.  (After some finagling, Mr. > Bieber and I decided it wasn't exactly

Re: brackets content regular expression

2008-10-31 Thread Pierre Quentel
On 31 oct, 20:38, netimen <[EMAIL PROTECTED]> wrote: > there may be different levels of nesting: > > "a < b < Ó > d > here starts a new group: < 1 < e < f  > g > 2 > > another group: < 3 >" > > On 31 окт, 21:57, netimen <[EMAIL PROTECTED]> wrote: > > > Thank's but if i have several top-level groups

Re: Converting a string to the most probable type

2008-03-08 Thread Pierre Quentel
> >>> def convert(x): > >         if '.' in x: >                 try: return float(x) >                 except ValueError: return x >         else: >                 try: return int(x) >                 except: return x > > >>> convert('123') > 123 > >>> convert('123.99') > 123.98 > >>>

Converting a string to the most probable type

2008-03-06 Thread Pierre Quentel
Hi, I would like to know if there is a module that converts a string to a value of the "most probable type" ; for instance : - if the string is "abcd" the value is the same string "abcd" - string "123" : value = the integer 123 - string "-1.23" (or "-1,23" if the locale for decimals is ,) : value

Re: Simple List division problem

2008-01-14 Thread Pierre Quentel
On 12 jan, 19:37, marcstuart <[EMAIL PROTECTED]> wrote: > How do I divide a list into a set group of sublist's- if the list is > not evenly dividable ? > consider this example: > > x = [1,2,3,4,5,6,7,8,9,10] > y = 3 # number of lists I want to break x into > z = y/x > > what I would like to ge

Re: Calculate an age

2007-12-08 Thread Pierre Quentel
On Dec 8, 10:04 am, Shane Geiger <[EMAIL PROTECTED]> wrote: > What is so obvious about dealing with months that vary in length and the > leap-year issue? Nothing. If you were born on a day that does not > exist every year (Feb 29th), how old are you on Feb 28th? X years, 11 months, 28 days or M

Re: Calculate an age

2007-12-07 Thread Pierre Quentel
On Dec 7, 7:09 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > How many days in a year? 365.25 (J2000 epoch), 365.2422 [as I > recall](B1900 epoch), 365.0 (non-leap year), 366 (leap year)? Gregorian > or Julian calendar -- and depending upon one's country, the Gregorian > reform may tak

Calculate an age

2007-12-06 Thread Pierre Quentel
Hi all, I have searched in the standard distribution if there was a function to return the difference between 2 dates expressed like an age : number of years, of months and days. The difference between datetime instances returns a timedelta object that gives a number of days, but not an age So is

Re: List of objects X Database

2007-10-03 Thread Pierre Quentel
On 3 oct, 22:01, MindMaster32 <[EMAIL PROTECTED]> wrote: Hi, Maybe PyDbLite (http://quentel.pierre.free.fr/PyDbLite/index.html) is what you need : a single Python module, compatible with Python 2.3+, that lets you manipulate data in memory You can manage a database like this : import PyDbLite d

Re: Processing drag & drop on the desktop

2007-09-21 Thread Pierre Quentel
On 21 sep, 08:58, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The shortcut must point to a *program*, not a *document*. > Change the "shortcut destination" to point to: > c:\path\to\python c:\path\to\your\script.py > > -- > Gabriel Genellina Thanks for the explanation Gabriel, it works fine

Re: Processing drag & drop on the desktop

2007-09-18 Thread Pierre Quentel
On 17 sep, 17:08, Larry Bates <[EMAIL PROTECTED]> wrote: > Pierre Quentel wrote: > > Hi all, > > > I would like to create an application on a Windows machine, such that > > when a document is dragged and dropped on the application icon on the > > deskt

Processing drag & drop on the desktop

2007-09-16 Thread Pierre Quentel
Hi all, I would like to create an application on a Windows machine, such that when a document is dragged and dropped on the application icon on the desktop, the document is processed by the application For instance, if I drag & drop an Outlook message or a PPT presentation, the application would

Re: Can python create a dictionary from a list comprehension?

2007-05-27 Thread Pierre Quentel
On 27 mai, 22:55, erikcw <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to turn o list of objects into a dictionary using a list > comprehension. > > Something like > > entries = {} > [entries[int(d.date.strftime('%m'))] = d.id] for d in links] > > I keep getting errors when I try to do it. Is i

Re: File DB instead of real database?

2007-04-13 Thread Pierre Quentel
On 14 avr, 06:14, "Jia Lu" <[EMAIL PROTECTED]> wrote: > Hello all > > I donot want to use a real DB like MySQL ... But I need something to > save about more than 1000 articles. > Is there any good ways? > Hi, For small sets of data PyDbLite is a good alternative to full-blown db engines >>> im

Re: how to build a forum in Python?

2007-04-05 Thread Pierre Quentel
Hi, I think you should take a look at Karrigell : http://karrigell.sourceforge.net It's a Python web framework and the package includes a forum application Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: help with dates

2007-03-31 Thread Pierre Quentel
> Four groups of firefighters (group1, group2, group3, group4). Each > group works a 24 hr shift. So group1 works April 1, group2 works April > 2, group3 works April 3, group4 works April 4, group 1 works April 5, > etc. It just keeps rolling like this forever into next year, etc. > > I need to com

Re: List comprehension returning subclassed list type?

2007-03-24 Thread Pierre Quentel
On 25 mar, 08:43, "bullockbefriending bard" <[EMAIL PROTECTED]> wrote: > Given: > > class Z(object): > various defs, etc. > > class ZList(list): > various defs, etc. > > i would like to be able to replace > > z_list = ZList() > for y in list_of_objects_of_class_Y: > z_list.append(y) > >

Re: CGI handler: Retrieving POST and GET at the same time

2007-03-10 Thread Pierre Quentel
On 10 mar, 19:52, "Samuel" <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following form: > > > > > > and would like to retrieve both fields, "one" and "two". However, the > following does not work: > > form_data = cgi.FieldStorage() > for key in form_data: > print key + ":", form_data[key]

Re: Building a dictionary from a tuple of variable length

2007-03-05 Thread Pierre Quentel
Hi, > Therefore, how do I build the tuple of Falses to reflect the length of my t > tuple? Yet another solution : d = dict(zip(t,[False]*len(t))) Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Pierre Quentel
> >>> parseline( 'A 1 22 3 6', 'sdxf') > ['A', 1, None, 3.0] Yes, but in this case the OP expects to get ['A',1,3.0] A shorter version : def parseline(line,format): xlat = {'x':None,'s':str,'f':float,'d':int,'i':int} result = [ xlat[f](w) for f,w in zip(format,line.split()) if xl

Re: paseline(my favorite simple script): does something similar exist?

2006-10-12 Thread Pierre Quentel
Hi Rick, Nice little script indeed ! You probably mean > trans = xlat.get(f,None) instead of > trans = xlat.get(f,'None') in the case where an invalid format character is supplied. The string 'None' evaluates to True, so that trans(words[i]) raises an exception A variant, with a

Re: Leave the putdowns in the Perl community, the Python world does not need them

2006-09-30 Thread Pierre Quentel
I am also shocked by Fredrick Lundh's impoliteness and think he makes this group less friendly than I expected when I read this on http://www.python.org/community/lists/: "Rudeness and personal attacks, even in reaction to blatant flamebait, are strongly frowned upon. People may strongly disagree

Re: Python blogging software

2006-09-13 Thread Pierre Quentel
Hi, There is a blog demo in Karrigell : http://karrigell.sourceforge.net There is a project called KarriBlog aiming to offer a more complete application, it's still beta but you can see it working on this site (in French) : http://www.salvatore.exolia.net/site Regards, Pierre -- http://mail.py

Re: best small database?

2006-09-13 Thread Pierre Quentel
Buzhug (like Karrigell and Strakell) is a Breton word ; Breton is the language spoken in Brittany, the westernmost part of France. Less and less spoken, actually, but I do, like all my ancestors. It is a close cousin of Welsh, and has common roots with Irish and Gaelic Buzhug means "earthworm", th

Re: best small database?

2006-09-11 Thread Pierre Quentel
Here are some pure-Python databases : - gadfly : an SQL engine, mature and well tested, works in memory so not fit for large data sets - SnakeSQL : another SQL engine, less mature I think and very slow when I tested it - KirbyBase : stores data in a single file ; uses a more Pythonic syntax (no SQL

Re: key not found in dictionary

2006-08-22 Thread Pierre Quentel
Depending on what you want to do if the key doesn't exist, you might want to use the dictionary method get() : value = some_dict.get(key,default) sets value to some_dict[key] if the key exists, and to default otherwise Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: modify element of a list.

2006-08-17 Thread Pierre Quentel
Hi, The most simple is to use the index of the element in the list : def setAttribute(self, desc, value): n = anObject(desc, value) for i,o in enumerate(self.Objects): if o.getDescription() == desc: self.Objects[i] = n return self.Objects.append(n) Pierre -- h

Re: reading specific lines of a file

2006-07-15 Thread Pierre Quentel
If the line number of the first line is 0 : source=open('afile.txt') for i,line in enumerate(source): if i == line_num: break print line Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating multiple lists from one list

2006-07-05 Thread Pierre Quentel
# first step : build a dictionary mapping the objects # to all possible ids alist = ['a.1','b.3','b.4','c.2','c.6','d.3'] elts = {} for item in alist: obj=item.split('.')[0] if elts.has_key(obj): elts[obj].append(item) else: elts[obj] = [item] # then build the Python c

Re: a class variable question

2006-06-28 Thread Pierre Quentel
Erik Max Francis wrote: > Note this only changes the attribute in the instance. If he wants it to > be changed for all other instances, he needs to change it in the class > with:: A._var1 = 1 Yes, but in the OP's code func1() is called by __init__ for every instance - which in fact makes declari

Re: a class variable question

2006-06-27 Thread Pierre Quentel
In func1, _var1 = 1 creates a local variable _var1 (local to the method), not an attribute of the instance. If you want an instance attribute you must specify the reference to the instance by self._var1 = 1 ; self must be passed as an attribute to func1 def func1(self): self._var1 = 1

Re: Re-loading updated modules

2006-06-27 Thread Pierre Quentel
Instead of exiting the interpreter, you can use reload() : see the section "Built-in functions" in the library reference "reload( module) Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited

Re: Can you help me with the below code? Urgent!

2006-06-25 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : > Hello, > > You're right about it but this is a simple code which tells my problem. > I need actually the frame itself for states and unfortunately > copy.copy(frame) throws an exception. Pickling also doesn't work. Do > you have any other idea? > > Thanks, > > Gokce.

Re: Can you help me with the below code? Urgent!

2006-06-25 Thread Pierre Quentel
This is because in "states" you store a reference to frame.f_locals, not the value it takes. When you print states, all the items are the same reference to the same object and have the same value If you want to store the values at each cycle you should store a copy of frame.f_locals, which will gi

Re: Search substring in a string and get index of all occurances

2006-06-21 Thread Pierre Quentel
mystring = 'John has a really nice powerbook.' substr = ' ' # space pos = 0 indices = [] while True: i = mystring.find(substr,pos) if i==-1: break indices.append(i) pos = i+1 print indices > [4, 8, 10, 17, 22] Pierre -- http://mail.python.org/mailman/listinfo/python-lis

Re: New Karrigel page in Wikipedia

2006-04-13 Thread Pierre Quentel
No, in the document root you create a folder "app1" and put all the files for the first application in it, and a folder "app2" for the second application For http://foo.example.com/app1 the server will search for an index file in this directory and serve it. You can also specify the script you wan

Re: New Karrigel page in Wikipedia

2006-04-13 Thread Pierre Quentel
The web server in Karrigell is actually application-independant. An application is a set of scripts or static files, generally stored in the same directory ; the server parses the http requests, searches for a file matching this request, processes the file according to its extension and sends the r

Re: New Karrigel page in Wikipedia

2006-04-13 Thread Pierre Quentel
Ok, thanks for the information. I have rewritten the page in a more neutral way and removed the tutorial-like part, I'll put in in wikibooks -- http://mail.python.org/mailman/listinfo/python-list

Re: New Karrigel page in Wikipedia

2006-04-13 Thread Pierre Quentel
I added an entry in Wikipedia for information, just like other Python web frameworks have already done. If the style doesn't fit Wikipedia's I'm sorry and willing to learn how to improve it ; the reason I read was "Obvious, if elaborate, link spam. Really should be speedied, but I can't find a CSD

Re: python library for web discussions

2006-03-19 Thread Pierre Quentel
Take a look at Karrigell (http://www.karrigell.com), it has a built-in forum application Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Too Many if Statements?

2006-02-07 Thread Pierre Quentel
This is because Python has a hidden mechanism to detect programs generated by Perl scripts, and make them crash with no explanation Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Server side newbie

2006-01-29 Thread Pierre Quentel
swisscheese a écrit : > I have a simple python desktop app with several edit controls and a > couple of buttons. It just does some math. What's the simplest way to > make it a server-side app so visitors to my site can run the app via > their browser? > Among the many web frameworks for Python, Ka

Re: Which Python web framework is most like Ruby on Rails?

2005-12-27 Thread Pierre Quentel
Yes, there is a clear winner : "python zope" = 3.950.000 Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
Just to add some more confusion to the discussion, here is what I've found about other web frameworks : CherryPy : BSD Django : BSD Jonpy : Python licence Quixote : CNRI Skunkweb : GPL or BSD Snakelets : MIT Subway : ? + licence of the components PythonWeb : LGPL (will consider BSD-Style or Python

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
In Karrigell the scripts are executed in a namespace prepared by the framework, with HTTP environment, form data, the functions and exceptions for authentication, session management, redirection etc. I suppose that this falls into the first category above, "modules (that) are designed to run linked

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
I definitely don't want to invent another licence, there are enough of them already ! Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Python web framework is most like Ruby on Rails?

2005-12-21 Thread Pierre Quentel
Hello all, I am Karrigell's author. I have chosen the GPL licence almost at random (I saw that the Python licence was GPL-compatible), so I don't mind switching to another Open Source licence if the GPL is liable to cause problems. Which one would you advice : BSD ? Python licence ? another ? Reg

"0 in [True,False]" returns True

2005-12-12 Thread Pierre Quentel
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in [True,False] My script didn't work in some cases and I eventually found that for v = 0 the test returned True So I changed my test for the obvious "if type(v) is bool", but I still find it confusing th

Re: strip not working on strings?

2005-11-13 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : > I'm using Python 2.3.5 and when I type the following in the interactive > prompt I see that strip() is not working as advertised: > > s = 'p p:p' s.strip(' :') > > 'p p:p' > > Is this just me or does it not work? I want to get rid of all ' ' and > ':' in th

Re: which feature of python do you like most?

2005-11-08 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : > > what is the thing that python makes you happy? > I discovered Python 5 years ago and I remember very well that what attracted me first was indentation. I had learnt JavaScript and rudiments of Java and couldn't decide on a consistent way of indenting my code, s

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : > > > My solution is sqlstring. A single-purpose library: to create SQL > statement objects. These objects (such as sqlstring.Select), represent > complex SQL Statements, but as Python objects. The benefit is that you > can, at run-time, "build" the statement pythonica

Concurrent access behind an asynchronous server

2005-09-18 Thread Pierre Quentel
Sorry if the question seems naive, but is there a risk of concurrent accesses to a database if it is accessed only by scripts called by requests to an asynchronous server ? I have the same question for a server built on the non-threaded version of SocketServer.TCPServer A+ Pierre -- http://ma

Strange os.path.exists() behaviour

2005-07-06 Thread Pierre Quentel
os.path.exists(path) returns True if "path" exists But on Windows it also returns True for "path" followed by any number of dots : Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >

Re: Declaring variables from a list

2005-04-09 Thread Pierre Quentel
You can use the built-in statement exec (http://www.python.org/doc/2.4.1/ref/exec.html) : # Blob = ['Var1', 'Var2', 'vAR3'] # i = 5 # for listitems in Blob: # i += 1 # exec('%s = i' %listitems) # # print Var1, Var2, vAR3 Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-li

Re: Web application toolkit recommendation?

2005-04-07 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : I have looked briefly at Karrigell. does it support user logins? S Yes, you can take a look at the "portal" demo to see how it works Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with tkinter

2005-03-29 Thread Pierre Quentel
Instead of indexing self.lab by strings, you can index them by the attributes themselves : self.lab[self.i], and change line 23 into for var in (self.s, self,i) For your example, I wouldn't have used the "text" option in the definition of the labels, then "textvariable" in the callback meth

Re: Widget geometry ?

2005-03-11 Thread Pierre Quentel
PGMoscatt a écrit : Hi All, I am trying to create a dialog which will have a number of components but having trouble with the placement of various widgets. For example, in my code below you will see I am trying to insert alabel but I want the label to be in the top-left of the dialog but it dosen't

Re: Tkinter and Text() widget interactivity ?

2005-03-01 Thread Pierre Quentel
Tonino a écrit : Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the ability to stop the text at any point. What I want to be able todo is select a line from the T

Re: intersection of 2 list of pairs

2005-02-21 Thread Pierre Quentel
Another method is to build two sets of sets, one for E1 and one for E2, then make the intersection of these sets - with Python 2.3 >>> E1=[('a','g'),('r','s')] >>> E2=[('g','a'),('r','q'),('f','h')] >>> from sets import Set,ImmutableSet >>> f=Set([ImmutableSet(s) for s in E1])& Set([ImmutableSet(

Re: recommended way of generating HTML from Python

2005-02-20 Thread Pierre Quentel
Here are a couple of pointers. I agree with Michele that it would be nice to have some kind of standardization. Maybe this would be worth a post to the Web-SIG ? - I posted a 70-line recipe on the Python Cookbook, a sort of poor man's HTMLGen called HTMLTags http://aspn.activestate.com/ASPN/Coo

Re: Probably over my head... Trying to get Font Names

2005-02-18 Thread Pierre Quentel
"Samantha" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > I am attempting to extract the Font Names from the installed windows fonts. > I am having a heck of a time getting these rather than the file names. > Examples can be seen by going to Control Panel > Fonts > > Any help

  1   2   >