Re: web hosting, first hand experiences?
On 19:59, Daniel Fetchinson wrote: Hi folks, I know this comes up regularly but the thing is that the quality of service changes also quite regularly with many of the hosting companies. What's currently the best option for shared hosting of a turbogears application? I'm thinking of dreamhost and webfaction does anyone have any recent experiences with these two? Or others? Cheers, Daniel Hi Daniel, I can wholeheartedly recommend WebFaction. I currently have an account running 3 different CherryPy applications (so TurboGears shouldn't pose any problems), and apart from initial teething problems, they have been running for months without interruption. As well as an excellent control panel, they give you full Linux command-line access to your site(s). The level of support is as good as you will get anywhere (short of having experts with you in the office!), and they know a huge amount about Python web applications. Nothing seems to be too much trouble for them. They also provide a 60-day money-back guarantee, so you can try-before-you-buy. Best wishes, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: py to exe converter
On 19:59, PATRICIA MEDINA wrote: I know there is a converter for python 2.x to executable file, but is there one for python 3.x yet? I use cx_Freeze without any problems (//cx-freeze.sourceforge.net/) HTH Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: py to exe converter
According to //sourceforge.net/projects/py2exe/files/, the latest version only goes as far as Python2.5 :-( Alan On 21/03/2011 19:47, Santoso Wijaya wrote: There's also py2exe: http://www..py2exe.org/ http://www.py2exe.org/ ~/santa On Mon, Mar 21, 2011 at 11:06 AM, Alan Harris-Reid a...@baselinedata.co.uk mailto:a...@baselinedata.co.uk wrote: On 19:59, PATRICIA MEDINA wrote: I know there is a converter for python 2.x to executable file, but is there one for python 3.x yet? I use cx_Freeze without any problems (//cx-freeze.sourceforge.net/ http://cx-freeze.sourceforge.net/) HTH Alan -- http://mail.python.org/mailman/listinfo/python-list No virus found in this message. Checked by AVG - www.avg.com http://www.avg.com Version: 10.0.1204 / Virus Database: 1498/3520 - Release Date: 03/21/11 -- http://mail.python.org/mailman/listinfo/python-list
Re: Career path - where next?
Hi Fred, thanks for the reply. I have already contacted old clients (those that are still in business), but unfortunately they have either gone the 'off the shelf' route (ie. don't use bespoke software any more), or moved-over to .NET, which is a route which I don't want to follow. Still, at least I've let them know what I am doing now and you never know where word-of-mouth may lead. I tried C# for a while, but after Foxpro it appeared to me to be such a horrible, clunky language. Then I discovered Python about a year ago and have loved it ever since. Regards, Alan On 17/01/2011 16:13, Sells, Fred wrote: Since you were burned by Microsoft dropping foxpro, I suspect many others were also. I would contact all my old clients and see how they are coping and tell them you've been converting FoxPro to *xyz* and can help them (assuming of course that you have done some of this). If they don't have anything, ask them for leads contacts. Trying to get a job cold is much more difficult than if you have a referral. -- http://mail.python.org/mailman/listinfo/python-list
Re: Career path - where next?
To all those who answered my original post so far (Jon Clements, Terry Jan Reedy, Philip Semanchuk) - many thanks. Your suggestions have given me a number of avenues to follow. I'll let you know how I get on. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Career path - where next?
Hi there, I wonder if any Python folk out there can help me. For many years I was a contractor developing desktop and web applications using Visual Foxpro as my main language, with Foxpro, SQL-server and Oracle as back-end databases. Unfortunately Foxpro was killed-off by Microsoft, hence my work dried-up and my last 'big' contract ended about a year ago. Since then I have taken time off programming doing house-renovation, and in the last 6 months I have been updating my programming skills by learning Python (3) with SQLite, JavaScript, HTML and CSS to a level where I can create and deploy data-based web-sites. My situation now is that I am reasonably comfortable with the above languages and am now in a position where I wish to return to employment using my new and/or existing skills (contract/permanent, full/part-time or teleworking). However, I have yet to find any UK vacancy which will accept a relative 'beginner' - they all require at least 2-3 years Python in a commercial environment. It's a catch-22 situation - it's hard to get a job without experience, but you need a job to get experience in the 1st place! I would even consider doing small projects for nothing so that I can 'get my foot in the door' (although I hope to be wise-enough to know when I am being taken advantage of!). I am also mailing CVs to agencies I think may be interested. If anyone out has ideas as to how to proceed towards achieving my goal, I would be grateful for any advice. Regards, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Framework design question
Hi, When committing data that has originally come from a webpage, sometimes data has to be converted to a data type or format which is suitable for the back-end database. For instance, a date in 'dd/mm/' format needs to be converted to a Python date-object or '-mm-dd' in order to be stored in a SQLite date column (SQLite will accept 'dd/mm/yy', but that can cause problems when data is retrieved). Question - at what point should the data be converted? a) As part of a generic web_page_save() method (immediately after data validation, but before a row.table_update() method is called). b) As part of row.table_update() (a data-object method called from web- or non-web-based applications, and includes construction of a field-value parameter list prior to executing the UPDATE command). In other words, from a framework point-of-view, does the data-conversion belong to page-object processing or data-object processing? Any opinions would be appreciated. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLite date fields
To all those who have replied on this thread - many thanks. It looks as though I've got to look further into date objects, SQLite's native date functions, detect_types, etc.. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
SQLite date fields
Hi, I am having design problems with date storage/retrieval using Python and SQLite. I understand that a SQLite date column stores dates as text in ISO format (ie. '2010-05-25'). So when I display a British date (eg. on a web-page) I convert the date using datetime.datetime.strptime(mydate,'%Y-%m-%d').strftime('%d/%m/%Y'). However, when it comes to writing-back data to the table, SQLite is very forgiving and is quite happy to store '25/06/2003' in a date field, but this is not ideal because a) I could be left with a mixture of date formats in the same column, b) SQLite's date functions only work with ISO format. Therefore I need to convert the date string back to ISO format before committing, but then I would need a generic function which checks data about to be written in all date fields and converts to ISO if necessary. That sounds a bit tedious to me, but maybe it is inevitable. Are there simpler solutions? Would it be easier to change the date field to a 10-character field and store 'dd/mm/' throughout the table? This way no conversion is required when reading or writing from the table, and I could use datetime() functions if I needed to perform any date-arithmetic. How have other developers overcome this problem? Any help would be appreciated. For the record, I am using SQLite3 with Python 3.1. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Compare source code
Hi jf, I use Beyond Compare (by Scooter Software) for comparing text files and find it an indespensible tool. You can configure it so that it ignores tabs/whitespace, or treats spaces and tabs as different characters. Not sure if it will work with compiled .pyc files, though (but then you wouldn't want to edit those, would you?) Regards, Alan On 19:59, jf wrote: Hi, I've a project with tabs and spaces mixed (yes I know it's bad). I edit each file to remove tabs, but it's so easy to make a mistake. Do you know a tools to compare the initial file with the cleaned one to know if the algorithms are the same ? By comparing pyc files for example. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Removing anti-Jewish postings from Python list
Any idea how we get rid of this 'noise'? Will it eventually go away if we ignore it, or is there anything the moderators can do to clean-up this (normally) wonderful resource for Python programmers? Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Binary file email attachment problem
Hi there, Using Python 3.1.2 I am having a problem sending binary attachment files (jpeg, pdf, etc.) - MIMEText attachments work fine. The code in question is as follows... for file in self.attachments: part = MIMEBase('application', octet-stream) part.set_payload(open(file,rb).read()) encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename=%s' % file) msg.attach(part) # msg is an instance of MIMEMultipart() server = smtplib.SMTP(host, port) server.login(username, password) server.sendmail(from_addr, all_recipients, msg.as_string()) However, way down in the calling-stack (see traceback below), it looks as though msg.as_string() has received an attachment which creates a payload of 'bytes' type instead of string. I suspect the error lies in the encoding somewhere, but I've no idea where. I have also tried MIMEApplication and MIMEImage, but the error still remains. I have seen many similar code examples on the web, all of which fail for me, so I wonder if there is something wrong with my environment. Has anyone any idea what might be causing the problem? Any help would be appreciated. Alan builtins.TypeError: string payload expected: class 'bytes' File c:\Dev\CommonPY\Scripts\email_send.py, line 147, in send server.sendmail(self.from_addr, all_recipients, msg.as_string()) File c:\Program Files\Python31\Lib\email\message.py, line 136, in as_string g.flatten(self, unixfrom=unixfrom) File c:\Program Files\Python31\Lib\email\generator.py, line 76, in flatten self._write(msg) File c:\Program Files\Python31\Lib\email\generator.py, line 101, in _write self._dispatch(msg) File c:\Program Files\Python31\Lib\email\generator.py, line 127, in _dispatch meth(msg) File c:\Program Files\Python31\Lib\email\generator.py, line 181, in _handle_multipart g.flatten(part, unixfrom=False) File c:\Program Files\Python31\Lib\email\generator.py, line 76, in flatten self._write(msg) File c:\Program Files\Python31\Lib\email\generator.py, line 101, in _write self._dispatch(msg) File c:\Program Files\Python31\Lib\email\generator.py, line 127, in _dispatch meth(msg) File c:\Program Files\Python31\Lib\email\generator.py, line 155, in _handle_text raise TypeError('string payload expected: %s' % type(payload)) -- http://mail.python.org/mailman/listinfo/python-list
Email attachment problem
Hi there, I want to send an email with an attachment using the following code (running under Python 3.1, greatly simplified to show example) from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText msg = MIMEMultipart() msg['From'] = from_addr msg['To'] = to_addr msg['Subject'] = subject msg.attach(MIMEText(body)) fp = open(att_file) att_msg = MIMEText(fp.read()) attachment = att_msg.add_header('Content-Disposition', 'attachment', filename=att_file) msg.attach(attachment) # set string to be sent as 3rd parameter to smptlib.SMTP.sendmail() send_string = msg.as_string() The attachment object msg1 returns 'email.mime.text.MIMEText' object at address', but when the att_msg.add_header(...) line runs the result is None, hence the program falls-over in msg.as_string() because no part of the attachment can have a None value. (Traceback shows 'NoneType' object has no attribute 'get_content_maintype' in line 118 of _dispatch in generator.py, many levels down from msg.as_string()) Has anyone any idea what the cause of the problem might be? Any help would be appreciated. Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Email attachment problem
Chris Rebert wrote: On Thu, Apr 29, 2010 at 1:06 PM, Alan Harris-Reid aharrisr...@googlemail.com wrote: Hi there, I want to send an email with an attachment using the following code (running under Python 3.1, greatly simplified to show example) from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText msg = MIMEMultipart() msg['From'] = from_addr msg['To'] = to_addr msg['Subject'] = subject msg.attach(MIMEText(body)) fp = open(att_file) att_msg = MIMEText(fp.read()) attachment = att_msg.add_header('Content-Disposition', 'attachment', filename=att_file) msg.attach(attachment) # set string to be sent as 3rd parameter to smptlib.SMTP.sendmail() send_string = msg.as_string() The attachment object msg1 returns 'email.mime.text.MIMEText' object at address', but when the att_msg.add_header(...) line runs the result is None, hence the program falls-over in msg.as_string() because no part of the attachment can have a None value. (Traceback shows 'NoneType' object has no attribute 'get_content_maintype' in line 118 of _dispatch in generator.py, many levels down from msg.as_string()) Has anyone any idea what the cause of the problem might be? Any help would be appreciated. .add_header() modifies the MIMEText object *in-place*; per Python conventions, mutator methods return None; hence, attachment = None. Try instead (untested): att_msg.add_header('Content-Disposition', 'attachment', filename=att_file) msg.attach(att_msg) Cheers, Chris -- http://blog.rebertia.com Hi Chris, You are right - that does the trick. Many thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Code redundancy
Andreas Löscher wrote: You can do something like this: class A(): pass inst=) exec( ... a= ... b=2 ... c=3 ... d=4 ... ) in inst.__dict__ inst.a 1 This executes the Statement in the exec function and uses inst.__dict__ as namespace. But be aware, that this is not recommended. If you mess with __dict__, you won't be able to replace it with some logic (parameter) if you need to do something more than setting a variable. Best Hi Andreas, thanks for the reply, Looks like I'll be sticking with repeating the class-name for a while. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Code redundancy
Ryan Kelly wrote: On Tue, 2010-04-20 at 14:43 +0100, Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? Please don't take this as in invitation to disregard the excellent advice already received in this thread - I just want to point out that python can usually be bent to your will. Observe: from withhacks import namespace with namespace(class1): attr1 = 1 attr2 = 2 This will do pretty much what you get from the with statement in javascript (I assume it's similar to Visual Foxpro). But don't use this in any real code. Seriously, don't even think about it. You don't want to know the kind of abuses that go on under the covers to make this kind of syntax hacking work... Cheers, Ryan Hi Ryan, thanks for that. No - I will not be adopting that solution. Is there anything Python can't do if you bend the rules far enough? ;-) Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Code redundancy
Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? Any help would be appreciated. Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Code redundancy
Jean-Michel Pichavant wrote: Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? Any help would be appreciated. Alan Harris-Reid Hello, Use an effective text editor, repeating stuff should not be a problem. In a more general manner, avoid trying to speed your writing while you should care speeding the reading. Most of the tricks you could use will confuse the reader (unless the reader is familiar with Visual foxpro). Anyway, for attrName, value in [ ('attr1', 1), ('attr2', 2), ('attr3', 3), ]: setattr(class1, attrName, value) or class Foo: def __init__(self): self.attr1=None self.attr2=None self.attr3=None def set(self, *args, **kwargs): for k in kwargs: if hasattr(self, k): setattr(self, k, kwargs[k]) else: raise AttributeError('%s instance has no attribute %s' % (self.__class__.__name__, k)) f = Foo() f.set(attr1=25) print f.__dict__ f.set(attr3=4, attr2=89) print f.__dict__ f.set(bar= 8) output: {'attr2': None, 'attr3': None, 'attr1': 25} {'attr2': 89, 'attr3': 4, 'attr1': 25} AttributeError: Foo instance has no attribute bar JM Hi Jean-Michel, Interesting solutions, but I think for the effort involved (and readability) I'll stick to repeating the class. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Code redundancy
Peter Otten wrote: Alan Harris-Reid wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? No. You could write a helper function def update(obj, **kw): ... for k, v in kw.items(): ... setattr(obj, k, v) ... and then use keyword arguments: class A: pass ... a = A() update(a, foo=42, bar=yadda) a.foo, a.bar (42, 'yadda') But if you are doing that a lot and if the attributes are as uniform as their names suggest you should rather use a Python dict than a custom class. d = {} d.update(foo=42, bar=whatever) d {'foo': 42, 'bar': 'whatever'} d[bar] 'whatever' Peter Hi Peter, thanks for the reply, Interesting solution, but it looks as though it may be easier to repeat the class prefix a few times. Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Code redundancy
Iain King wrote: On Apr 20, 2:43 pm, Alan Harris-Reid aharrisr...@googlemail.com wrote: Hi, During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = class1.attr2 = class1.attr3 = class1.attr4 = etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = .attr2 = .attr3 = .attr4 = etc. endwith Is there any equivalent to this in Python? Any help would be appreciated. Alan Harris-Reid The pythonic equivalent of VB 'with' is to assign to a short variable name, for example '_': _ =lass1 _.attr1 = _.attr2 = _.attr3 = _.attr4 = alternatively, you could use the __setattr__ method: for attr, value in ( ('attr1', 1), ('attr2', 2), ('attr3', 3), ('attr4', 4)): class1.__setattr__(attr, value) and to get a bit crunchy, with this your specific example can be written: for i in xrange(1, 5): class1.__setattr__('attr%d' % i, i) Iain Hi Iain, thanks for the reply, Like the _. prefix idea - I didn't know _ could be used as a variable name. for i in xrange(1, 5): class1.__setattr__('attr%d' % i, i) Good solution if the values matched the attribute names, but unfortunately they don't. That was just a (bad) example to illustrate my problem. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Code redundancy
Stefan Behnel wrote: div class=moz-text-flowedAlan Harris-Reid, 20.04.2010 15:43: During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? There's more than one way to do this, depending on your actual needs and the source of the attributes. I assume this is done in __init__? This might work for you: self.__dict__.update(attr1=1, attr2=2, attr3=3, attr4=4) You should also think once more about the use of the code you presented above, having to set all those attributes may have a little smell. Maybe that's totally ok, but since you mention that you often find yourself doing the above, you may also have a mental design problem somewhere. We can't tell unless you provide a more concrete example than what you show above. Stefan Hi Stefan, thanks for the reply. The code is not usually in class.__init__ (otherwise I would have used the self. prefix), but I like your self.__dict__.update(...) solution and I'll try and remember it. The code I was thinking of goes something like as follows (don't have a specific example to hand, but the principal is the same)... NewClass = BaseClass() NewClass.attr1 = value1 NewClass.attr2 = value2 NewClass.attr3 = value3 etc. So if there are more than a couple of attributes to set for a class instance, how would you approach it (short of passing the values as parameters to BaseClass)? Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Code redundancy
Xavier Ho wrote: On Wed, Apr 21, 2010 at 7:59 AM, Alan Harris-Reid aharrisr...@googlemail.com mailto:aharrisr...@googlemail.com wrote: The code is not usually in class.__init__ (otherwise I would have used the self. prefix) Alan, if your variables are not usually in __init__, what's preventing you from using class variables like this: class Test(): ... something = 1 ... more = 2 ... Test.more 2 What's your use case? Cheers, Xav Hi Xavier, thanks for the reply, In this case I am setting attributes of an instantiated class, so the original class might go something like class Test attr1 = some default value attr2 = another default value attr3 = yet another default value etc. and the instantiated class might go something like Test2 = Test() Test2.attr1 = runtime value Test2.attr2 = another runtime value etc. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Code redundancy
Chris Rebert wrote: On Tue, Apr 20, 2010 at 2:59 PM, Alan Harris-Reid aharrisr...@googlemail.com wrote: Stefan Behnel wrote: Alan Harris-Reid, 20.04.2010 15:43: During my Python (3.1) programming I often find myself having to repeat code such as... class1.attr1 = 1 class1.attr2 = 2 class1.attr3 = 3 class1.attr4 = 4 etc. Is there any way to achieve the same result without having to repeat the class1 prefix? Before Python my previous main language was Visual Foxpro, which had the syntax... with class1 .attr1 = 1 .attr2 = 2 .attr3 = 3 .attr4 = 4 etc. endwith Is there any equivalent to this in Python? There's more than one way to do this, depending on your actual needs and the source of the attributes. I assume this is done in __init__? This might work for you: self.__dict__.update(attr1=1, attr2=2, attr3=3, attr4=4) You should also think once more about the use of the code you presented above, having to set all those attributes may have a little smell. Maybe that's totally ok, but since you mention that you often find yourself doing the above, you may also have a mental design problem somewhere. We can't tell unless you provide a more concrete example than what you show above. Stefan Hi Stefan, thanks for the reply. The code is not usually in class.__init__ (otherwise I would have used the self. prefix), but I like your self.__dict__.update(...) solution and I'll try and remember it. The code I was thinking of goes something like as follows (don't have a specific example to hand, but the principal is the same)... NewClass = BaseClass() NewClass.attr1 = value1 NewClass.attr2 = value2 NewClass.attr3 = value3 etc. So if there are more than a couple of attributes to set for a class instance, how would you approach it (short of passing the values as parameters to BaseClass)? Why are you against passing them as parameters? If your constructor would have a lot of parameters, it may be a sign that: (A) you have some Data Clumps (http://martinfowler.com/bliki/DataClump.html) among the parameters that ought to be made into full objects (B) your class is doing too many things and needs to be split into multiple classes (http://www.refactoring.com/catalog/extractClass.html) Cheers, Chris -- Yay Refactoring! http://blog.rebertia.com Hi Chris, thanks for the reply. Nothing against passing the values as parameters, but it can start to look a bit ugly if there are too many of them. Which brings me to your 2nd point of maybe refactoring the passing/receiving of parameters so that I can use an object with attributes instead of individual variable values. Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Code redundancy
Ethan Furman wrote: Alan Harris-Reid wrote: The code is not usually in class.__init__ (otherwise I would have used the self. prefix), but I like your self.__dict__.update(...) solution and I'll try and remember it. The code I was thinking of goes something like as follows (don't have a specific example to hand, but the principal is the same)... NewClass = BaseClass() NewClass.attr1 = value1 NewClass.attr2 = value2 NewClass.attr3 = value3 etc. So if there are more than a couple of attributes to set for a class instance, how would you approach it (short of passing the values as parameters to BaseClass)? Unless I'm missing something (your use-case, perhaps? ;) in this example NewClass is *not* a class -- it's an instance of BaseClass, and you are dynamically adding attributes to it. It's definitely a switch coming from FoxPro (me, too!), but it is well worth it once your brain starts working pythonically. ~Ethan~ Hi Ethan, You are correct - NewClass is an instance of BaseClass and I chose a very bad class-name as an example. Good to see ex-Fox people on this list. I have recently got stuck-into learning Python after my last VFP contract finished last December - wish I had started years ago. Really glad I went for Python, which I thought would be the easiest transition from Foxpro (I looked at other languages, but none came near to Python in terms of popularity and developer-friendly syntax). What's your story? Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Super() function
³p wrote: Hi: On 25 March 2010 11:17, Alan Harris-Reid aharrisr...@googlemail.com mailto:aharrisr...@googlemail.com wrote: Hi, Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() some more code... Is there any way of writing the code so that the super() call is generic and automatically recognises the name of the current method (ie. something like super().thismethod()) or do I always have to repeat the method name after super()? TIA, Alan -- http://mail.python.org/mailman/listinfo/python-list I think, the super() method is designed to delegate any method call to one of the class in its mro list, and the super() function its self return a 'super' object, so it is better to write what method you want to delegate, maybe it's not the current method. -- Best wishes from Ray ... Thanks Ray - I'll stick to repeating the method name. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Super() function
Gabriel Genellina wrote: div class=moz-text-flowedEn Thu, 25 Mar 2010 00:17:52 -0300, Alan Harris-Reid aharrisr...@googlemail.com escribió: Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() some more code... Is there any way of writing the code so that the super() call is generic and automatically recognises the name of the current method (ie. something like super().thismethod()) or do I always have to repeat the method name after super()? This recipe does what you want: http://code.activestate.com/recipes/286195-selfsuper/ (but requires a bit of black magic...) Hi Gabriel - thanks for the reply. Goodness me - that's a mighty complicated recipe for what I want to achieve! I think I'll stick with repeating the method name - it's a small price to pay. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Super() function
Hi, Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example def mymethod(self): super().mymethod() some more code... Is there any way of writing the code so that the super() call is generic and automatically recognises the name of the current method (ie. something like super().thismethod()) or do I always have to repeat the method name after super()? TIA, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: DreamPie - The Python shell you've always dreamed about!
gorauskas wrote: I installed it on a Windows 7 machine with CPython 2.6.4 and I get the following error: Traceback (most recent call last): File dreampie.py, line 3, in module File dreampielib\gui\__init__.pyc, line 73, in module File dreampielib\gui\load_pygtk.pyc, line 49, in load_pygtk ImportError: DLL load failed: The specified module could not be found. What am I doing wrong? Thanks, JGG And I installed it on WinXP sp3 and Python 3.1 - when launched a window flashes before my eyes, then disappears! Has the installation package been checked for all common Windows versions? Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: DreamPie - The Python shell you've always dreamed about!
Chris Colbert wrote: Do you have gtk and PyGTK installed? Sounds like a missing dependency to me. On Tue, Feb 23, 2010 at 6:56 AM, Alan Harris-Reid aharrisr...@googlemail.com mailto:aharrisr...@googlemail.com wrote: gorauskas wrote: I installed it on a Windows 7 machine with CPython 2.6.4 and I get the following error: Traceback (most recent call last): File dreampie.py, line 3, in module File dreampielib\gui\__init__.pyc, line 73, in module File dreampielib\gui\load_pygtk.pyc, line 49, in load_pygtk ImportError: DLL load failed: The specified module could not be found. What am I doing wrong? Thanks, JGG And I installed it on WinXP sp3 and Python 3.1 - when launched a window flashes before my eyes, then disappears! Has the installation package been checked for all common Windows versions? Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list Hi Chris, thanks for the reply, That explains it. No, I don't have gtk installed - I wasn't aware of that dependency. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Editor for Python
Hi Laszlo, I use Wing IDE (not free, $35 for personal edition) and PyScripter (free). I find both good, for different reasons. Regards, Alan Laszlo Nagy wrote: Hi All, I know that this question was put up on this list a thousand times. I know that most of the editors are listed here: http://wiki.python.org/moin/PythonEditors I already tried most of them. But still, I need something that is not listed there. Requirements: * starts and works fast * has code folding, displays identation guides * auto completion * class browser * source code browser (e.g. a list of definitions, when you click it jumps to the definition * integration with pychecker or pylint * UTF-8 files * free, or not-so-expensive * works on linux and windows The one I'm using now is Geany. It does everything, except class browser and pychecker/pylint. Now maybe, I can install (or write??) a geany extension that would allow me to use pychecker. But I could not find information on that. There where others I tried (PyPE, DrPython, KomodoEdit, Editra etc.) but all of them failed for some reason. Can you please suggest another editor that I could try? Or send me a link that tells how to write or install pychecked plugin for Geany. Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: Passing parameters in URL
Many thanks to all those who replied to my question and clearing-up the differences between GET and POST. I think I know what to do now - if not, I'll be back :-) Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Passing parameters in URL
I have a web-page where each row in a grid has edit/delete buttons to enable the user to maintain a selected record on another page. The buttons are in the form of a link with href='/item_edit?id=123', but this string appears in the URL and gives clues as to how to bypass the correct sequence of events, and could be risky if they entered the URL directly (especially when it comes to deleting records). Is there another way of passing a record-id to a method a) without it appearing in the URL? b) without the user being able to fathom-out how to attach which id to which URL? As each link contains row-id, I guess there is nothing to stop someone from getting the id from the page source-code. Is it safe to use the above href method if I test for authorised credentials (user/password stored as session variables, perhaps?) before performing the edit/delete action? I am currently using CherryPy 3.2, but I guess the theory could apply to any HTTP framework or web app.. Any help would be appreciated. Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading issue with SQLite
Many thanks to all who replied to my questions re. SQLite connections, cursors and threading. Looks like I have got some reading to do regarding connection pooling and a decent SQLite ORM package. Does anyone know of any which are Python 3 compatible? Many thanks, Alanj -- http://mail.python.org/mailman/listinfo/python-list
Threading issue with SQLite
Hi, I am creating a web application (using Python 3.1 and CherryPy 3.2) where a SQLite connection and cursor object are created using the following code (simplified from the original): class MainSite: con = sqlite.connect('MyDatabase.db') cursor = con.cursor() def index_page(): some HTML code cursor.execute(some SQL statement) more HTML code def another_page(): some HTML code cursor.execute(anotherSQL statement) more HTML code When I call a URL which launches the another_page() method I get the error message sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. Questions... 1. Is there a large overhead in opening a new SQLite connection for each thread (ie. within each method)? 2. Is there any way to use the same connection for the whole class (or should I forget that idea completely?) 3. When a method returns to the calling method, is the connection automatically closed (assuming the object is local, of course) or does it have to be done explicitly using connection.close()? TIA, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: python 3's adoption
Xah Lee wrote: Some thoughts about Python 3 Adoption. Xah Lee, 2010-01-26 Some notes of Wikipedia readings related to Python. Unladen Swallow, a new project from Google. It is a new python compiler with the goal of 5 times faster than the de facto standand implementation CPython. Also note Stackless Python, which is already been used in some major commercial projects. Was looking into what's new in Python 3. See: http://docs.python.org/dev/3.0/whatsnew/3.0.html. From a quick reading, i don't really like it. Here's some highlights: * Print is now a function. Great, much improvement. * Many functions that return lists now returns Views or Iterators Instead. A fucking fuck all fucked up shit. A extraneous oop engineering complication. (See: Lambda in Python 3000) * The cmp() function used in sort is basically gone, users are now supposed to use the key parameter instead. This is a flying-face- fuck to computer science. This would be the most serious fuckup in python 3. (See: Sorting in Python and Perl) * Integers by default is long. Great! * Much more integrated unicode support, rewrite of most its text or string semantics. Fantastic. Finally. Am looking because i wonder if i should switch to python 3 for my own few scripts, and rewrite my Python Tutorial for version 3. Am also interested to know how python 3 is received by the computing industry. Apparantly, a little search on the web indicates that vast majority of python base have not switched, as expected, for many good reasons. Vast majority of major python modules and tools have not switched. Most linux distro have not switched, i don't find any large corporation having adopted Python 3 (Google, Yahoo, Facebook, NASA,... ). (sources: Source, Source) Basically, such a incompatible change with trivial, ideological improvements, is too costy to switch. I wonder, if by 2015, will most large corporate users have switched to python 3. I give it a maybe. In today's Proliferation of Computing Languages, such a major antic by Guido can just hurt itself. What is he thinking? He of course thought himself as a god of lang designer, who sincerely wants to push towards perfection, all future-looking. Unfortunately, the tens of other major language designers all think similarly. perm archive of this post with possible updates here: http://xahlee.org/comp/python3.html Any comment on this? Xah ? http://xahlee.org/ Hello Xah, I have no figures to base this on (just what I have read on the web), but although the vast majority of comanies with big Python investments are probably waiting for the 'critical mass' to use Python3 regularly (oil-tanker effect), I would like to think that smaller operations are experimenting with it more-and-more. I think that for beginners who have dived into Python in the last 6-12 months (like me), it doesn't make sense to start with an older version. I do not want to learn 'old' syntax and functions of a language, only to have to learn the new versions when most developers upgrade to 3 - I might as well learn the new syntax now and be ahead-of-the-game ;-) . I know my choice of related packages (web-framework, ORM, templating-engine) is very limited at present, but there are enough branches and beta-versions around to help me with my learning-curve, and I figure there will be some full-production-releases around by the time I am 'fluent' with Python (12-18 months?). Currently I am using Python 3.1 and CherryPy (3.20 rc1) every day, and have had no serious problems (yet). I would be interested to hear how other people are using Python 3, and with what compatible packages. Regards, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic HTML controls
Aahz wrote: In article mailman.820.1263266822.28905.python-l...@python.org, Alan Harris-Reid aharrisr...@googlemail.com wrote: 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... You might look at Quixote: http://quixote.ca/ Thanks for that Aahz - I'll check it out. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic HTML controls
Pierre Quentel wrote: On 12 jan, 04:26, Alan Harris-Reid aharrisr...@googlemail.com 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 =tml_table() # instantiate class MyTable.data =ata_list# data-list (eg. cursor from SQL SELECT statement) MyTable.border = MyTable.width =87 MyTable.column_headers =ol_headers# list or tuple of column-headers table_code =yTable.table.create() # returns string containing appropriate HTML code I don't mind writing my own classes (it will be good practice for me), but I don't want to re-invent the wheel if it can be avoided. TIA, Alan Harris-Reid Hi, There are a few modules to generate HTML from Python : there is a list at http://wiki.python.org/moin/Templating, section HTML Generation packages With HTMLTags, your example would be coded like this : from HTMLTags import * table =ABLE(border=1,width~7) table =R(Sum([TD(header) for header in col_headers])) for result in data_list: table =R(Sum([TD(value) for value in result])) print table The operator =eans add child in the DOM tree structure, it avoids having to nest tags with brackets - Pierre Thanks Pierre. I can see this module being very useful. I have downloaded the code from the Activestate site (is that the latest version?) and will try it out as soon as possible. Is HTMLTags Python3 compatible? (I am using 3.1). Regards, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic HTML controls
alex23 wrote: On Jan 12, 1:26 pm, Alan Harris-Reid aharrisr...@googlemail.com wrote: Does anyone know where I can find any decent dynamically-constructed HTML control classes (dropdown list, table, input field, checkbox, etc.) written in Python. There's pyWeb[1], which seems pretty close to what you're asking for: mytable =able(align='center', cellspacing=0, cellpadding=3, border= mytable.add(tr(td(first row), td(second row))) While it might be a little heavier than what you're after, you should also be able to do this with ToscaWidgets[2]. You'd probably have to make basic widgets for the general HTML controls, but that would give you a good head-start on writing your own, more complex widgets. Widgets can be a compilation of Python, HTML, CSS JS. (I used this fairly extensively when it used to be called TurboWidgets) If you want to roll your own from scratch, I'm a big fan of the html [3] library: from html import HTML h =TML() with h.table(border=', width='987'): ... with h.tr: ... for header in ['column 1', 'column 2']: ... h.th(header) ... print h table width=87 border=1 trthcolumn 1/ththcolumn 2/th/tr /table 1: http://www.freenet.org.nz/python/pyweb 2: http://toscawidgets.org 3: http://pypi.python.org/pypi/html/1.7 Hi Alex (I'm assuming that is your name from your nickname) Thanks for the reply - I'll check-out all 3 solutions you suggest and I'm sure I'll find something near to what I am looking for. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Dynamic HTML controls
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 = html_table() # instantiate class MyTable.data = data_list# data-list (eg. cursor from SQL SELECT statement) MyTable.border = 1 MyTable.width = 987 MyTable.column_headers = col_headers# list or tuple of column-headers table_code = MyTable.table.create() # returns string containing appropriate HTML code I don't mind writing my own classes (it will be good practice for me), but I don't want to re-invent the wheel if it can be avoided. TIA, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Sys.path entries
Marco Salden wrote: On Dec 30, 8:13 pm, Alan Harris-Reid a...@baselinedata.co.uk wrote: Hi there, In my sys.path (interpreter only, no application loaded), I have the following strange entries... 'C:\\WINDOWS\\system32\\python31.zip'. This file does not exist anywhere (although python31.dll does exist in \windows\system32\), where could it have come from? 'C:\\program files\\python31\\lib\\plat-win'. There is no such directory, although I can see that this has been added by the PYTHONPATH varible in PyConfig.h (when is this loaded?) Is there any way of removing these entries, or are they best left where they are? (I am using Python 3.1 on WinXP) Also, regarding PyConfig.h - is this read every time I start Python.exe? Many thanks, Alan Harris-Reid Hi Alan, Same for me: C:\Windows\system32\python25.zip is in the only non-C: \Python25 directroyfile in my sys.path (under Python 2.5). No idea why it needs it. And also in my case the zip file isnt in that location anyway. So also not 3K only or so. But I have no issues with it (so far :-)), do you? Do you run into problems because of this in the path? HTH, Marco Hi Marco,thanks for the reply, No, it doesn't cause any problems. I just thought it would be nice to have a 'clean' path environment as possible. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Sys.path entries
Gabriel Genellina wrote: div class=moz-text-flowedEn Thu, 31 Dec 2009 04:31:06 -0300, Marco Salden marco.sal...@gmail.com escribió: On Dec 30, 8:13 pm, Alan Harris-Reid a...@baselinedata.co.uk wrote: Hi there, In my sys.path (interpreter only, no application loaded), I have the following strange entries... 'C:\\WINDOWS\\system32\\python31.zip'. This file does not exist anywhere (although python31.dll does exist in \windows\system32\), where could it have come from? 'C:\\program files\\python31\\lib\\plat-win'. There is no such directory, although I can see that this has been added by the PYTHONPATH varible in PyConfig.h (when is this loaded?) Is there any way of removing these entries, or are they best left where they are? (I am using Python 3.1 on WinXP) Same for me: C:\Windows\system32\python25.zip is in the only non-C: \Python25 directroyfile in my sys.path (under Python 2.5). No idea why it needs it. And also in my case the zip file isnt in that location anyway. So also not 3K only or so. But I have no issues with it (so far :-)), do you? Do you run into problems because of this in the path? Don't worry. The pythonNN.zip entry in sys.path is required to allow a complete Python install to reside in a .zip file -- all modules used at start time (os, ntpath, site...) must be importable before user code has a chance of altering the import mechanisms. Tools like py2exe may take advantage of that. See PEP 273: http://www.python.org/dev/peps/pep-0273/ Normally, such zip file doesn't exist, and Python just ignores its sys.path entry; look at sys.path_importer_cache: py sys.path_importer_cache ... 'C:\\WINDOWS\\system32\\python26.zip': imp.NullImporter object at 0x00AB0028, 'd:\\apps\\python26\\lib\\plat-win': imp.NullImporter object at 0x00AB0480, 'd:\\apps\\python26\\lib\\site-packages': None, ... Same for the plat-win directory; someone *could* use it for Windows-specific stuff, but it doesn't exist by default and is simply ignored. Also, regarding PyConfig.h - is this read every time I start Python.exe? No. It's a copy of the .h file used when Python was compiled from its C sources. distutils may read it to gather some information. Unless you compile the interpreter from source yourself, it serves no other purpose than document the options originally used to compile it. Thanks for the reply Gabriel. All useful stuff to store in my (ever-fading) brain. Regards Alan -- http://mail.python.org/mailman/listinfo/python-list
Sys.path entries
Hi there, In my sys.path (interpreter only, no application loaded), I have the following strange entries... 'C:\\WINDOWS\\system32\\python31.zip'. This file does not exist anywhere (although python31.dll does exist in \windows\system32\), where could it have come from? 'C:\\program files\\python31\\lib\\plat-win'. There is no such directory, although I can see that this has been added by the PYTHONPATH varible in PyConfig.h (when is this loaded?) Is there any way of removing these entries, or are they best left where they are? (I am using Python 3.1 on WinXP) Also, regarding PyConfig.h - is this read every time I start Python.exe? Many thanks, Alan Harris-Reid -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: String prefix question
Gerard Flanagan wrote: div class=moz-text-flowedAlan Harris-Reid wrote: In the Python.org 3.1 documentation (section 20.4.6), there is a simple “Hello World” WSGI application which includes the following method... def hello_world_app(environ, start_response): status ='200 OK' # HTTP Status headers =(b'Content-type', b'text/plain; charset=utf-8')] # HTTP Headers start_response(status, headers) # The returned object is going to be printed return [bHello World] Question - Can anyone tell me why the 'b' prefix is present before each string? The method seems to work equally well with and without the prefix. From what I can gather from the documentation the b prefix represents a bytes literal, but can anyone explain (in simple english) what this means? Many thanks, Alan Another link: http://www.stereoplex.com/two-voices/python-unicode-and-unicodedecodeerror /div Gerard - thanks for the link - explains it well. Many thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: String prefix question
Benjamin Kaplan wrote: On Sun, Nov 8, 2009 at 9:38 PM, Alan Harris-Reid a...@baselinedata.co.uk wrote: In the Python.org 3.1 documentation (section 20.4.6), there is a simple Hello World WSGI application which includes the following method... def hello_world_app(environ, start_response): status ='200 OK' # HTTP Status headers =(b'Content-type', b'text/plain; charset=utf-8')] # HTTP Headers start_response(status, headers) # The returned object is going to be printed return [bHello World] Question - Can anyone tell me why the 'b' prefix is present before each string? The method seems to work equally well with and without the prefix. From what I can gather from the documentation the b prefix represents a bytes literal, but can anyone explain (in simple english) what this means? Many thanks, Alan The rather long version: read http://www.joelonsoftware.com/articles/Unicode.html A somewhat shorter summary, along with how Python deals with this: Once upon a time, someone decided to allocate 1 byte for each character. Since everything the Americans who made the computers needed fit into 7 bits, this was alright. And they called this the American Standard Code for Information Interchange (ASCII). When computers came along, device manufacturers realized that they had 128 characters that didn't mean anything, so they all made their own characters to show for the upper 128. And when they started selling computers internationally, they used the upper 128 to store the characters they needed for the local language. This had several problems. 1) Files made by on one computer in one country wouldn't display right in a computer made by a different manufacturer or for a different country 2) The 256 characters were enough for most Western languages, but Chinese and Japanese need a whole lot more. To solve this problem, Unicode was created. Rather than thinking of each character as a distinct set of bits, it just assigns a number to each one (a code point). The bottom 128 characters are the original ASCII set, and everything else you could think of was added on top of that - other alphabets, mathematical symbols, music notes, cuneiform, dominos, mah jong tiles, and more. Unicode is harder to implement than a simple byte array, but it means strings are universal- every program will interpret them exactly the same. Unicode strings in python are the default ('') in Python 3.x and created in 2.x by putting a u in front of the string declaration (u'') Unicode, however, is a concept, and concepts can't be mapped to bits that can be sent through the network or stored on the hard drive. So instead we deal with strings internally as Unicode and then give them an encoding when we send them back out. Some encodings, such as UTF-8, can have multiple bytes per character and, as such, can deal with the full range of Unicode characters. Other times, programs still expect the old 8-bit encodings like ISO-8859-1 or the Windows Ansi code pages. In Python, to declare that the string is a literal set of bytes and the program should not try and interpret it, you use b'' in Python 3.x, or just declare it normally in Python 2.x (''). -- What happens in your program: When you print a Unicode string, Python has to decide what encoding to use. If you're printing to a terminal, Python looks for the terminal's encoding and uses that. In the event that it doesn't know what encoding to use, Python defaults to ASCII because that's compatible with almost everything. Since the string you're sending to the web page only contains ASCII characters, the automatic conversion works fine if you don't specify the b''. Since the resulting page uses UTF-8 (which you declare in the header), which is compatible with ASCII, the output looks fine. If you try sending a string that has non-ASCII characters, the program might throw a UnicodeEncodeError because it doesn't know what bytes to use for those characters. It may be able to guess, but since I haven't used WSGI directly before, I can't say for sure. Thanks Benjamin - great 'history' lesson - explains it well. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
String prefix question
In the Python.org 3.1 documentation (section 20.4.6), there is a simple “Hello World” WSGI application which includes the following method... def hello_world_app(environ, start_response): status = b'200 OK' # HTTP Status headers = [(b'Content-type', b'text/plain; charset=utf-8')] # HTTP Headers start_response(status, headers) # The returned object is going to be printed return [bHello World] Question - Can anyone tell me why the 'b' prefix is present before each string? The method seems to work equally well with and without the prefix. From what I can gather from the documentation the b prefix represents a bytes literal, but can anyone explain (in simple english) what this means? Many thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Web development with Python 3.1
mario ruggier wrote: With respect to to original question regarding web frameworks + database and Python 3, all the following have been available for Python 3 since the day Python 3.0 was released: QP, a Web Framework http://pypi.python.org/pypi/qp/ Durus, a Python Object Database (the default in qp, for user sessions, etc) http://pypi.python.org/pypi/Durus/ Evoque, state-of-the-art templating engine http://pypi.python.org/pypi/evoque/ (this one is available for py3.0 since a little later, 21-jan-2009) All the above also runs on python 2.4 (thru to python 3) For the record, you may see the list of all pypi packages availabe for Python 3 at: http://pypi.python.org/pypi?:action=browseshow=allc=533 m. Thanks for those links Mario - I'll check them out asap.. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Web development with Python 3.1
John Nagle wrote: div class=moz-text-flowedAlan Harris-Reid wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 Until MySQLdb gets ported to something later than Python 2.5, support for a data-based web site probably has to be in Python 2.5 or earlier. The C module situation for Python 3.x still isn't very good. Realistically, the production version of Python is 2.5. This process is taking long enough that I'm worried that Python 3.x could do for Python what Perl 6 did for Perl - provide an upgrade path that nobody takes. HTMLTemplate (http://py-templates.sourceforge.net/htmltemplate/index.html;) is a minimal templating system for fill-in-the-blanks template work in Python. Actually, if you have HTMLTemplate, FCGI, and MySQLdb, you have enough to do a back-end database. There are some advantages to libraries (you call them) over frameworks (they call you) if you're doing something unusual. Frameworks are more useful if you're doing yet another Web 2.0 web site. John Nagle /div Thanks for the advice John. I am concerned at what you say about the uptake of 3.x - you could be right (although I hope you eventually turn-out to be wrong :-) ). Regards Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Web development with Python 3.1
Martin v. Löwis wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting don't - start with 2.6), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python3 compatible yet. That's not entirely true, see http://wiki.python.org/moin/PortingDjangoTo3k Regards, Martin Interesting link. Thanks for the info. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Web development with Python 3.1
Aaron Watters wrote: On Oct 25, 7:52 pm, Alan Harris-Reid a...@baselinedata.co.uk wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting don't - start with 2.6), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python3 compatible yet. So, what can I use to start my web programming experience using 3.1? Any help would be appreciated. Alan Don't. use python 2.6 with WHIFF :) http://aaron.oirt.rutgers.edu/myapp/GenBankTree/index http://whiff.sourceforge.net -- Aaron Watters Thanks for the advice Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Web development with Python 3.1
Exarkun - thanks for the reply don't - start with 2.6 Thought you might say that ;-) Regards, Alan On 25 Oct, 11:52 pm, a...@baselinedata.co.uk wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting don't - start with 2.6), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python3 compatible yet. So, what can I use to start my web programming experience using 3.1? Any help would be appreciated. don't - start with 2.6 Alan -- http://mail.python.org/mailman/listinfo/python-list No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.423 / Virus Database: 270.14.31/2458 - Release Date: 10/25/09 08:10:00 -- http://mail.python.org/mailman/listinfo/python-list
Re: Web development with Python 3.1
Anyway, for simple web programming, frameworks are not worth the hassle. Just use the cgi module. I can vouch for what Paul says. I started in Python 3 years ago, and I did so with a web application (still working on it!). I'm using the cgi approach, and it certainly teaches you the concepts. I fail to see how starting with a framework is a good idea if you don't know how the frameworks work (or what they're actually doing). It would be a bit like doing a web page in Dreamw***er and thinking you understand HTML/CSS. B Hi Brendon, thanks for the advice. Looks like I'll have to go the cgi route myself if I want to stick with with Python3. Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Web development with Python 3.1
Hi Paul, thanks for the reply (despite the sarcasm ;-) ), Does it occur to you that the unavailability of those frameworks is part of the REASON they say to use 2.x? Of course, but that doesn't mean that there isn't someone out there who may know of a framework that is already Python3 compatible, or is being worked-on. Have you answered your own question? No Anyway, for simple web programming, frameworks are not worth the hassle. Just use the cgi module. Ok - I'll look into it. ... you are the one who decided to zoom off into the 3.1 wilderness before the framework developers got there. I haven't zoomed-off anywhere yet - in fact I've hardly started. I made the decision to start with 3.1 based on the fact that it was the latest version, and hoping that there may be some framework stuff out there (because 3.0 has been out for a while now). However, it looks as though I might have to review that decision, but what I've learned so far is pretty simple stuff, so it won't be wasted. Regards, Alan Alan Harris-Reid a...@baselinedata.co.uk writes: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting don't - start with 2.6), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python3 compatible yet. So, what can I use to start my web programming experience using 3.1? Does it occur to you that the unavailability of those frameworks is part of the REASON they say to use 2.x? Have you answered your own question? Anyway, for simple web programming, frameworks are not worth the hassle. Just use the cgi module. If you want to use a framework, well, you are the one who decided to zoom off into the 3.1 wilderness before the framework developers got there. If you're an experienced programmer in other languages and you're determined to use a framework, maybe a worthwhile Python learning project would be to help port your favorite framework to 3.1. -- http://mail.python.org/mailman/listinfo/python-list
Web development with Python 3.1
I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting don't - start with 2.6), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python3 compatible yet. So, what can I use to start my web programming experience using 3.1? Any help would be appreciated. Alan -- http://mail.python.org/mailman/listinfo/python-list