3.7.6 struggles a bit
When i wrote a program, i tried to open it but it struggles to open. -- https://mail.python.org/mailman/listinfo/python-list
Beginner question: use function to read text file
I'm pretty stuck at the moment and wondering if anyone can spot the problem. Trying to create a function that will read a text file into a list and return that list. I wrote the following function and saved it as 'fileloader.py' def fileload(fname): infile=open(fname) dates =[] times=[] open=[] high=[] low=[] close=[] vol=[] count=0 for line in infile: item=line.split() dates.append(item[0]) times.append(item[1]) open.append(item[2]) high.append(item[3]) low.append(item[4]) close.append(item[5]) vol.append(item[6]) #print dates[count],times[count],open[count],high[count],low[count],vol[count] count=count+1 return dates,times,open,high,low,close Then I executed the following script (merge contract v1.py): import fileloader filename='c:/Python24/test/testdata2.txt' fileloader.fileload(filename) I then get the following error messages: Traceback (most recent call last) File "C:\Python24\test\merge contract v1.py", in line3, in? fileloader.fileload(filename) File ("C:\Python24\text\fileloader.py", in line2, in fileload infile=open(fname) UnboundLocalError: local variable 'open' referenced before assignment Script terminated Thanks for any help, Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: Beginner question: use function to read text file
Thanks to both of you for the help, much appreciated! Luke -- http://mail.python.org/mailman/listinfo/python-list
incompatible with
Built-in functions don't bind to classes like regular functions. Is this intended? (I do notice that the Python Reference Manual sec 3.2 under "Class Instance" refers to a "user-defined function"). Any ideas what the reason is for this distinction between build-in functions and normal functions? It's rather inconvenient when implementing some methods (not the whole class) in a C extension :-( $ python Python 2.4.2 (#1, Nov 3 2005, 12:41:57) [GCC 3.4.3-20050110 (Gentoo Linux 3.4.3.20050110, ssp-3.4.3.20050110-0, pie-8.7 on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def normal_func(x): ... return x ... >>> class foo(object): ... a = normal_func ... b = lambda x : x ... c = abs ... >>> obj = foo() >>> obj.a > >>> obj.b of <__main__.foo object at 0xb7c3766c>> >>> obj.c -- http://mail.python.org/mailman/listinfo/python-list
Re: incompatible with
Thanks James, though from the output of b.x() it appears that x is a class method (ie the class is passed as the first parameter rather than the instance)... -- http://mail.python.org/mailman/listinfo/python-list
Sci.linalg.lu permuation error
I'm trying to use Scipy's LU factorization. Here is what I've got: from numpy import * import scipy as Sci import scipy.linalg A=array([[3., -2., 1., 0., 0.],[-1., 1., 0., 1., 0.],[4., 1., 0., 0., 1.]]) p,l,u=Sci.linalg.lu(A,permute_l = 0) now, according to the documentation: ** Definition: Sci.linalg.lu(a, permute_l=0, overwrite_a=0) Docstring: Return LU decompostion of a matrix. Inputs: a -- An M x N matrix. permute_l -- Perform matrix multiplication p * l [disabled]. Outputs: p,l,u -- LU decomposition matrices of a [permute_l=0] pl,u -- LU decomposition matrices of a [permute_l=1] Definitions: a = p * l * u[permute_l=0] a = pl * u [permute_l=1] p - An M x M permutation matrix l - An M x K lower triangular or trapezoidal matrix with unit-diagonal u - An K x N upper triangular or trapezoidal matrix K = min(M,N) * So it would seem that from my above commands, I should have: A == dot(p,dot(l,u)) but instead, this results in: In [21]: dot(p,dot(l,u)) Out[21]: array([[-1., 1., 0., 1., 0.], [ 4., 1., 0., 0., 1.], [ 3., -2., 1., 0., 0.]]) Which isn't equal to A!!! In [23]: A Out[23]: array([[ 3., -2., 1., 0., 0.], [-1., 1., 0., 1., 0.], [ 4., 1., 0., 0., 1.]]) However, if I do use p.T instead of p: In [22]: dot(p.T,dot(l,u)) Out[22]: array([[ 3., -2., 1., 0., 0.], [-1., 1., 0., 1., 0.], [ 4., 1., 0., 0., 1.]]) I get the correct answer. Either the documentation is wrong, or somehow Scipy is returning the wrong permutation matrix... anybody have any experience with this or tell me how to submit a bug report? Thanks. ~Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: Python implementation of "include"
Gabriel Genellina wrote: > En Thu, 13 Dec 2007 19:53:49 -0300, <[EMAIL PROTECTED]> escribió: > >> As I understand it, import myFile and include "myFile.py" are not quite >> the same. >> >> -- >> for import to work myFile.py must be in the same directory as the code >> that calls it accessible through PYTHONPATH, whereas include >> "../somedirectory/myFile.py" works in Karrigell, even though it is not >> accessible through PYTHONPATH. >> >> -- if imported, the print >> statement myFile.py would only run the first time through unless >> reload(myFile) is executed in the proper place. > > execfile("../somedirectory/myFile.py") does not have those problems. > place your code within the module into a function, then in the calling file just include the module using "include myFile", to get at the code you want to use, simply call the function as "myFile.myFunction()". (obviously, drop the quotes and use the names you made for the module and function...) -- http://mail.python.org/mailman/listinfo/python-list
MySQLdb syntax issues - HELP
Im very new to SQL in general, let alone coding it into python. I can interact with a MySQL database just fine for the most part, but im running into some problems here... This is the function in my script that keeps raising errors: - def NewChar(): """ NewChar() - Call this function to begin new character generation. At this time it is the only function you need to call from the NewCharacter module. It takes no arguments. """ CharAccount = NewAccount() CharName = raw_input("Enter New Characters Name: \n") CharGender = NewGender() CharJob = NewJob() CharLevel = "1" Attributes = GetAtt() ###--- imports the attributes to be added to character info Strength = Attributes[0] Dexterity = Attributes[1] Inteligence = Attributes[2] Charm = Attributes[3] Luck = Attributes[4] ###--- This will print the results to a script that will be used to store ###--- and retrieve character data for use in the game. It will eventually ###--- be phased out by a database or encrypted file and calling scripts so ###--- it wont be accessable by the user. #AppendChar = '\n["' + CharName + '", "' + CharGender + '", "' + CharJob + '", ' + CharLevel + ', ' + Strength + ', ' + Dexterity + ', ' + Inteligence + ', ' + Charm + ', ' + Luck + ']' #CharSheet = "Character.hro" #CharOutput = open(CharSheet, 'a', 5000) #CharOutput.writelines(AppendChar) #CharOutput.close() ###--- MySQL implementation of the new character save. conn = MySQLdb.connect(host = 'localhost', user = 'hero', passwd = 'password', db = 'hero') cursor = conn.cursor() cursor.execute(""" CREATE TABLE %s ( name CHAR(40), gender CHAR(40), job CHAR(40), levelTEXT, str TEXT, dex TEXT, intelTEXT, cha TEXT, luc TEXT ) """ % CharAccount) CharInfo = (CharAccount, CharName, CharGender, CharJob, CharLevel, Strength, Dexterity, Inteligence, Charm, Luck) cursor.execute(""" INSERT INTO %s (name, gender, job, level, str, dex, intel, cha, luc) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) """, (CharAccount, CharName, CharGender, CharJob, CharLevel, Strength, Dexterity, Inteligence, Charm, Luck)) cursor.execute("SELECT name, job FROM %s" % CharAccount) while (1): row = cursor.fetchone() if row == None: break print "\n \n \n You just created: %s \n Job class is: %s" % (row[0], row[1]) cursor.close() conn.commit() conn.close() print "\n \n \n Your character is made!" MakeAgain = raw_input("\n \n \n Would you like to make another character while we are at it? (y, n): \n") MakeAgain = MakeAgain.lower() MakeAgain = MakeAgain[0] if MakeAgain == "y": NewChar() else: return --- The part that keeps getting me errors is: --- cursor.execute(""" INSERT INTO %s (name, gender, job, level, str, dex, intel, cha, luc) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) """, (CharAccount, CharName, CharGender, CharJob, CharLevel, Strength, Dexterity, Inteligence, Charm, Luck)) --- i have tried various ways to do this string insertion, and i keep getting errors. it seems that MySQLdb doesnt like me assigning a string to the table name if im going to assign more to values... I have reworked the last line so many times its pathetic and have seen about 3 or 4 different errors, but they are almost all being raised by the same functions within the MySQLdb code. All variables i am attempting to assign are in string form and have worked in a test script i made that does everything the same except substituting the strings within my query. Ive been stuck on this all week and have read numerous tutorials, the DB-API specification sheet, the MySQL manual, the MySQLdb documentation, and a few books... none of which seem to adress my problem since they are all only assigning variables to the table name OR the values of the query, not both. Please help me figure this out. -- http://mail.python.org/mailman/listinfo/python-list
Re: MySQLdb syntax issues - HELP
Bruno Desthuilliers wrote: > Luke a écrit : (snip) >> cursor.execute(""" >> CREATE TABLE %s >> ( >> name CHAR(40), >> gender CHAR(40), >> job CHAR(40), >> levelTEXT, >> str TEXT, >> dex TEXT, >> intelTEXT, >> cha TEXT, >> luc TEXT >> ) >> """ % CharAccount) > > Err... Are you sure you want a new table here ? (snip) yes, thats the easier way i can think of for now since i am so new to SQL, eventually im sure i will put all the characters into one larger table though... but for now i just dont feal like figuring out how to scan the table for the records i need based on name of character... ill save that for later. (unless there is a very easy way to do it that doesnt require re) (snip) >> The part that keeps getting me errors is: >> >> --- >> >> cursor.execute(""" >>INSERT INTO %s (name, gender, job, level, str, dex, intel, cha, >>luc) VALUES >> (%s, %s, %s, %s, %s, %s, %s, %s, %s) >> """, (CharAccount, CharName, CharGender, CharJob, CharLevel, >> Strength, >> Dexterity, Inteligence, Charm, Luck)) >> >> --- >> >> i have tried various ways to do this string insertion, and i keep getting >> errors. it seems that MySQLdb doesnt like me assigning a string to the >> table name if im going to assign more to values... > > Your problem comes from confusion between Python's string formating > system and db-api query arguments system - which sometimes (as here) use > the same placeholder mark. > > What you want here is: > > sql = """ > INSERT INTO %s (name, gender, job, level, str, dex, intel, cha, luc) > VALUES (%%s, %%s, %%s, %%s, %%s, %%s, %%s, %%s, %%s) > """ % CharAccount > > cursor.execute(sql, (CharName, CharGender, CharJob, CharLevel, > Strength, Dexterity, Inteligence, Charm, Luck)) wow, i was so focused on learning the MySQLdb module i have been overlooking simply escaping my % signs the whole time... nice catch, thanks alot. it works like a charm now. PROBLEM SOLVED, BUT IF YOU WANT TO ADD ANYTHING, FEEL FREE... -- http://mail.python.org/mailman/listinfo/python-list
Data mapper - need to map an dictionary of values to a model
I am writing an order management console. I need to create an import system that is easy to extend. For now, I want to accept an dictionary of values and map them to my data model. The thing is, I need to do things to certain columns: - I need to filter some of the values (data comes in as -MM- DDTHH:MM:SS-(TIMEZONE-OFFSET) and it needs to map to Order.date as a -MM-DD field) - I need to map parts of an input column to more than one model param (for instance if I get a full name for input--like "John Smith"--I need a function to break it apart and map it to Order.shipping_first_name and Order.shipping_last_name) - Sometimes I need to do it the other way too... I need to map multiple input columns to one model param (If I get a shipping fee, a shipping tax, and a shipping discount, I need them added together and mapped to Order.shipping_fee) I have begun this process, but I'm finding it difficult to come up with a good system that is extensible and easy to understand. I won't always be the one writing the importers, so I'd like it to be pretty straight-forward. Any ideas? Oh, I should also mention that many times the data will map to several different models. For instance, the importer I'm writing first would map to 3 different models (Order, OrderItem, and OrderCharge) I am not looking for anybody to write any code for me. I'm simply asking for inspiration. What design patterns would you use here? Why? -- http://mail.python.org/mailman/listinfo/python-list
Re: Data mapper - need to map an dictionary of values to a model
On Jan 15, 1:53 am, [EMAIL PROTECTED] wrote: > Luke: > > >What design patterns would you use here?< > > What about "generator (scanner) with parameters"? :-) > > Bye, > bearophile I'm not familiar with this pattern. I will search around, but if you have any links or you would like to elaborate, that would be wonderful. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Data mapper - need to map an dictionary of values to a model
On Jan 15, 3:53 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 14, 7:56 pm, Luke <[EMAIL PROTECTED]> wrote: > > > > > I am writing an order management console. I need to create an import > > system that is easy to extend. For now, I want to accept an dictionary > > of values and map them to my data model. The thing is, I need to do > > things to certain columns: > > > - I need to filter some of the values (data comes in as -MM- > > DDTHH:MM:SS-(TIMEZONE-OFFSET) and it needs to map to Order.date as a > > -MM-DD field) > > - I need to map parts of an input column to more than one model param > > (for instance if I get a full name for input--like "John Smith"--I > > need a function to break it apart and map it to > > Order.shipping_first_name and Order.shipping_last_name) > > - Sometimes I need to do it the other way too... I need to map > > multiple input columns to one model param (If I get a shipping fee, a > > shipping tax, and a shipping discount, I need them added together and > > mapped to Order.shipping_fee) > > > I have begun this process, but I'm finding it difficult to come up > > with a good system that is extensible and easy to understand. I won't > > always be the one writing the importers, so I'd like it to be pretty > > straight-forward. Any ideas? > > > Oh, I should also mention that many times the data will map to several > > different models. For instance, the importer I'm writing first would > > map to 3 different models (Order, OrderItem, and OrderCharge) > > > I am not looking for anybody to write any code for me. I'm simply > > asking for inspiration. What design patterns would you use here? Why? > > The specific transformations you describe are simple to be coded > directly but unless you constrain the set of possible transformations > that can take place, I don't see how can this be generalized in any > useful way. It just seems too open-ended. > > The only pattern I can see here is breaking down the overall > transformation to independent steps, just like the three you > described. Given some way to specify each separate transformation, > their combination can be factored out. To illustrate, here's a trivial > example (with dicts for both input and output): > > class MultiTransformer(object): > def __init__(self, *tranformers): > self._tranformers = tranformers > > def __call__(self, input): > output = {} > for t in self._tranformers: > output.update(t(input)) > return output > > date_tranformer = lambda input: {'date' : input['date'][:10]} > name_tranformer = lambda input: dict( >zip(('first_name', 'last_name'), >input['name'])) > fee_tranformer = lambda input: {'fee' : sum([input['fee'], > input['tax'], > input['discount']])} > tranformer = MultiTransformer(date_tranformer, > name_tranformer, > fee_tranformer) > print tranformer(dict(date='2007-12-22 03:18:99-EST', > name='John Smith', > fee=30450.99, > tax=459.15, > discount=985)) > # output > #{'date': '2007-12-22', 'fee': 31895.1403, > 'first_name': #'J', 'last_name': 'o'} > > You can see that the MultiTransformer doesn't buy you much by itself; > it just allows dividing the overall task to smaller bits that can be > documented, tested and reused separately. For anything more > sophisticated, you have to constrain what are the possible > transformations that can happen. I did something similar for > transforming CSV input rows (http://pypi.python.org/pypi/csvutils/) so > that it's easy to specify 1-to-{0,1} transformations but not 1-to-many > or many-to-1. > > HTH, > George thank you that is very helpful. I will ponder that for a while :) -- http://mail.python.org/mailman/listinfo/python-list
working with a subversion repo
I want to write a script that automatically generates a subversion repository and configures apache serve the svn repo. Is there a python module that will allow me to work with subversion? I am able to import a module named "svn" on my ubuntu machine, but this module is not available on windows. I also can't seem to find any documentation on it. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: working with a subversion repo
On Jan 17, 9:14 am, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080117 17:21], Luke ([EMAIL PROTECTED]) wrote: > > >I am able to import a module named "svn" on my ubuntu machine, but this > >module is not available on windows. > > The entries libsvn and svn are installed in site-packages when you install the > Python (SWIG) bindings for Subversion. > > -- > Jeroen Ruigrok van der Werven / asmodai > イェルーン ラウフロック ヴァン デル ウェルヴェンhttp://www.in-nomine.org/|http://www.rangaku.org/ > Nothing is constant but change... I'm sorry, I'm sort a n00b to python. Does that mean that libsvn and svn are not modules? If they are modules, where can I find documentation for them? What do they do? -- http://mail.python.org/mailman/listinfo/python-list
Tkinter
Hello, I'm an inexperienced programmer and I'm trying to make a Tkinter window and have so far been unsuccessful in being able to delete widgets from the main window and then add new ones back into the window without closing the main window. The coding looks similar to this: from Tkinter import * def MainWin(): main=Tk() main.geometry('640x480') back_ground=Frame(main,width=640,height=480,bg='black') back_ground.pack_propagate(0) back_ground.pack(side=TOP,anchor=N) frame1=Frame(back_ground,width=213,height=480,bg='light gray') frame1.pack_propagate(0) frame1.pack(side=TOP,anchor=N) close_frame1=Button(frame1,text='close',bg='light gray', command=frame1.destroy) close_frame1.pack_propagate(0) close_frame1.pack(side=TOP, anchor=N,pady=25) if frame1.destroy==True: frame1=Frame(back_ground,width=213,height=480,bg='white') frame1.pack_propagate(0) frame1.pack(side=TOP,anchor=N) main.mainloop() MainWin() It may just be bad coding but either way I could use some help. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter
Thanks, Its working smoothly now -- http://mail.python.org/mailman/listinfo/python-list
Re: Framework for a beginner
On Thu, Apr 19, 2012 at 12:20 PM, Alek Storm wrote: > On Wed, Apr 18, 2012 at 11:21 PM, lkcl wrote: >> >> On Apr 11, 9:11 pm, biofob...@gmail.com wrote: >> >> > I am new to python and only have read the Byte of Python ebook, but want >> > to move to the web. I am tired of being a CMS tweaker and after I tried >> > python, ruby and php, the python language makes more sense (if that makes >> > any "sense" for the real programmers). >> >> yeah, it does :) python is... the best word i can describe it is: >> it's beautiful. it has an elegance of expression that is only marred >> by the rather silly mistake of not taking map, filter and reduce into >> the list object itself: l.map(str) for example would be intuitive, >> compact and elegant. instead, i have to look up how to use map each >> and every damn time! the reason for the mistake is historical: map, >> filter and reduce were contributed by a lisp programmer. that lisp >> programmer, presumably, was used to everything being function(args...) >> and it simply didn't occur to anyone to properly integrate map, filter >> and reduce properly into the list objects that they work with. > > > Why not use list comprehension syntax? because it's less characters to type, and thus less characters to read. i find that syntax incredibly klunky. left to right you're reading, "you declare something to be the case... and then oh whoops actually it's not really the case because it's modified by a list thing" - it breaks reading expectations. that's what i meant about beauty and elegance. the "bang per buck" ratio in python, results obtained for the number of characters used, is higher, and that's something that i personally find to be a priority over speed. you don't *have* to use lambdas with map and reduce, you just have to use a function, where a lambda happens to be a nameless function. another example of the compactness of python is kicking around somewhere, i wish i could remember where it is. it compares scheme with python and java. scheme does this amazing programming "thing" in a single operator, expressed in 3 characters. python manages the same thing in about 10, and java requires *six* lines! > It gets you map and filter > functionality for free, and is more readable than python's clunky version of > lambdas. I believe they're faster than the for-loop equivalents, but I'm not > sure about the actual map() and filter() functions (reduce() was removed > from 3.0 for reasons I will never understand). likewise. /salutes -- http://mail.python.org/mailman/listinfo/python-list
Re: Framework for a beginner
On Thu, Apr 19, 2012 at 1:21 PM, Alek Storm wrote: > On Thu, Apr 19, 2012 at 7:12 AM, lkcl luke wrote: >> >> On Thu, Apr 19, 2012 at 12:20 PM, Alek Storm wrote: >> > Why not use list comprehension syntax? >> >> because it's less characters to type, and thus less characters to >> read. i find that syntax incredibly klunky. left to right you're >> reading, "you declare something to be the case... and then oh whoops >> actually it's not really the case because it's modified by a list >> thing" - it breaks reading expectations. >> >> that's what i meant about beauty and elegance. the "bang per buck" >> ratio in python, results obtained for the number of characters used, >> is higher, and that's something that i personally find to be a >> priority over speed. > > > Did I miss something? `[a+1 for a in some_list]` is shorter than both > `map(lambda a: a+1, some_list)` and `some_list.map(lambda a: a+1)`. :) yes you missed something. :) a) if you use that lambda a:a+1 a lot, you make it an actual function, don't you? even for clarity you'd still probably use a function not a lambda. i use map quite a lot, filter and reduce not so much. a more real-world example was one that i actually gave initially: map(str, l). or, the syntax i really prefer which doesn't exist: l.map(str). or, one that i also use in web applications or their back-ends: map(int, l). if you have a comma-separated set of variables in a single string, like this: "5, 20, 3", i tend to use this: from string import strip l = map(int, map(strip, l.split(","))) ok to make it clearer i sometimes do that on 3 separate lines. i'd _love_ it to be this: l = l.split(",").map(strip).map(int) or even better would be this: l = l.split(",").map(strip, int) b) read the text from left to right, in plain english: * map(str, l): you're going to map i.e. apply a string function to a list's members. (now you see why i keep getting confused with "map", because the natural language version of this is "map a list's members to a string" - the other way round) * a+1 for a in l: take an expression which is a mathematical operation and therefore has the expectation that its arguments are mathematical in nature. then oh damn it wait a minute, actually there's more going on here: for every variable in a list, use the variables in the expression to make a new list... i'm belabouring the point (not entirely intentionally) but you see how clumsy that is? it's probably just as complex in the actual lexer/grammar file in the http://python.org source code itself, as it is to think about in real life and to psychologically parse in english. you actually have to think *backwards*! is that clearer, or have i added mud? :) l. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
David Schwartz wrote: > "Roedy Green" <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >>On Tue, 18 Oct 2005 20:30:42 -0700, "David Schwartz" >><[EMAIL PROTECTED]> wrote or quoted : > >>> No, taken stupidly. Hint: would or would not MS executives disobeying >>>the law constitute a betrayal of their obligation to their shareholders? > >>You stated it literally as if making maximum profit for the >>shareholders were the only consideration in determining conduct. > > No, I did not. I said that their obligation is to their shareholders. As much as I hate to jump in on this thread, well I'm gonna... I think you'll find that companies have all manner of legal obligations. Certainly to their shareholders, but beyond that they have an obligation to their clients, who pay them for their services, and to any individual or entity which might be harmed by their actions. A classic case in point would be Philip Morris, who did everything they could to protect their shareholders, but who shirked their duty of care to their customers and the the public at large. They have since paid heavily for that failure. >>If that is not what you mean, I think you need to hedge more. > > I was perfectly clear. This is a lot of deliberate misunderstanding > going on in this thread and very little of it is from my side. All that means to me is that your misunderstanding is not deliberate. Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows GUIs from Python
On Tue, 11 Jan 2005 12:55:42 -0600, Doug Holton <[EMAIL PROTECTED]> wrote: >You might also be interested in PyGUI although it doesn't have a native >Windows implementation yet: >http://nz.cosc.canterbury.ac.nz/~greg/python_gui/ Generally speaking, appart from MFC-style programming with Python32, what are the non-alpha alternatives to write purely Windows apps in Python today, ie. without the weight of extra bagage like wxWidgets? I'm not looking at fancy options, since the apps I write would be fine with just the core Windows widgets along with a few add-ons like a grid and the extended Win95 widgets. Thx Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows GUIs from Python
On Tue, 11 Jan 2005 22:15:36 +0100, Thomas Heller <[EMAIL PROTECTED]> wrote: >Well, venster. Although it is most certainly alpha. But with some >work... Thx, I'll keep an eye on it. http://venster.sourceforge.net/ Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Zen of Python
On Wed, 19 Jan 2005 14:13:47 -0500, Timothy Fitz <[EMAIL PROTECTED]> wrote: >While I agree that the Zen of Python is an amazingly concise list of >truisms, I do not see any meaning in: (snip) For those interested, here's the list: http://www.python.org/doc/Humor.html#zen Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: WYSIWYG wxPython "IDE"....?
On Mon, 07 Feb 2005 11:54:08 +0100, Uwe Grauer <[EMAIL PROTECTED]> wrote: >Most People don't realize, that they have to use the cvs-version >instead. It's rather that most people prefer to use the latest stable version, since stuff under CVS is still under development. Does someone know why the Boa people didn't extract a newer, stable version from CVS? To the OP: This topic comes up about every week, and the conclusion I drew after taking a look, is that Python is not a good solution to build GUI apps, although it's an excellent command-line, text scripting tool. To me, the very fact that the only solution if you don't want to carry a multi-megabyte widget set with you (either wxWidgets or QT is to go the MFC way (which a lot of C developers seem to hate) through PyWin32, and the absence of a really good GUI builder like VB or Delphi shows that it's just not a good solution to build big GUI apps, although good enough for smaller apps like BitTorrent etc. Sad, but true. I guess it just shows that building a GUI development tool like those two takes quite a lot of work, hence money, but there doesn't seem to be a demand high enough to warrant this venture. My conclusion: If you want to write GUI apps that require a very rich interface while keeping the installer small (and raw performance is important), Python is currently not a good solution. YMMV :-) Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: WYSIWYG wxPython "IDE"....?
On Tue, 08 Feb 2005 01:25:06 +1100, Jussi Jumppanen <[EMAIL PROTECTED]> wrote: >> To me, the very fact that the only solution if you don't want >> to carry a multi-megabyte widget set with you (either wxWidgets >> or QT is to go the MFC way (which a lot of C developers seem >> to hate) through > >Have you ever tried to use MFC in anything other than a >simple application? ... which is why I said that the alternative of using PyWin32 didn't sound like a lot of fun :-) Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Mon, 7 Feb 2005 18:30:18 +0100, Michael Goettsche <[EMAIL PROTECTED]> wrote: >Not 100% right. Only drivers for commercial databases will not be included, >mysql and co. are available. What I find weird, is that I always understood the GPL meaning that you must give back any contribution you made to the source code of the GPLed code, but not if you're just using either a binary distribution (eg. a DLL) or if you copy/pasted the code as is, with no changes on your own. If this is true, then the fact that Qt is now GPLed for Windows means that I should be able to use this widget set even in commercial apps since I'm not making any change to Qt, just using it. Am I totally off-target? Cheers Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Mon, 7 Feb 2005 19:41:11 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >> Am I totally off-target? > >yes. for details, see the "Combining work with code released under the >GPL" section on this page: Mmmm.. The FAQ isn't very clear about whether it's allowed to write a proprietary EXE that calls a GPLed DLL: "However, in many cases you can distribute the GPL-covered software alongside your proprietary system. To do this validly, you must make sure that the free and non-free programs communicate at arms length, that they are not combined in a way that would make them effectively a single program. The difference between this and "incorporating" the GPL-covered software is partly a matter of substance and partly form. The substantive part is this: if the two programs are combined so that they become effectively two parts of one program, then you can't treat them as two separate programs. So the GPL has to cover the whole thing." Considering the fact that the Qt DLL exist by themselves, that the version used is the one provided by Qt, and that the EXE uses a standard, open way to communicate with it, the above does seem to say this use would be valid. Anybody knows of a similar case and the output? Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Tue, 08 Feb 2005 07:57:51 +1100, Tim Churches <[EMAIL PROTECTED]> wrote: >Thus, it seems to me, and to the expert legal advice which we sought >(note the scope of the advice was Australian law only) that provided no >GLPed source or object code is mixed, included or combined with >non-GPLed code, and that the GPLed and non-GPLed code are distributed or >otherwise made available in packages which are very clearly separate >works, and that any interaction between the two is restricted to >runtime, then the GPL does not require that non-GPLed code to be >distributed under the GPL. That's how I understood things, ie. calling a standard, clearly independent (ie. EXE or DLL) binary downloaded from the project's web site and just calling it is not covered by the GPL since no change has been made whatsoever to the original work. Which makes sense, since the goal of the GPL is to make sure that no one can steal the code, correct bugs or add features without redistributing those changes. Muddy waters, indeed :-) Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Tue, 08 Feb 2005 10:47:25 +1100, Tim Churches <[EMAIL PROTECTED]> wrote: >So there you have it: there must be some portion of the GPLed Program >contained in >the other work for it to fall under the scope of the GPL, and/or as defined as >a >derivative work in local copyright law (local because the GPL does not >nominate a >particular jurisdiction for covering law). Has someone worked with Qt for Windows before, and could tell us whether it involves static or dynamic linking? If dynamic, then, it doesn't make sense that an EXE that builds on Qt should also be GPLed. Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Mon, 07 Feb 2005 17:47:30 -0800, Robert Kern <[EMAIL PROTECTED]> wrote: >Now, that's not to say that they are correct in their interpretation of >the GPL's terms. In fact, if I had to bet on an outcome, I'd probably >wager that the court would hold that only static linking would force the >program as a whole to follow the GPL terms. However, I certainly don't >have the money to pony up to run a test case. Consequently, I try to >follow the wishes of the copyright holder. It's strange that something so central hasn't been clarified yet, but maybe it's part of the changes meant for V.3. When you think about it, it'd be like banning any closed-source apps from being developed for Linux, since any application makes syscalls to the kernel and its libraries. But the fact is that there are now closed-source apps for that platform, and are considered legit since those apps don't include code from the kernel, but instead, merely make calls to binary objects. I fail to see the difference between making calls to the kernel API and making calls to Qt libraries. Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Big development in the GUI realm
On Tue, 08 Feb 2005 13:24:35 +1100, Tim Churches <[EMAIL PROTECTED]> wrote: >: NOTE! This copyright does *not* cover user programs that use kernel >: services by normal system calls - this is merely considered normal use >: of the kernel, and does *not* fall under the heading of "derived work". OK, so according to Linus, the GPL allows a proprietary program to make calls to the kernel, but TrollTech says the GPL doesn't allow a proprietary program to make calls to the Qt library. It's this double-standard that I find confusing, since both projects are said to be based on the same license. I wouldn't have any problem if Qt had built its own GPL-derived, custom license, but they claim it's the same ol' GPL. Hence the questioning. Luke. -- http://mail.python.org/mailman/listinfo/python-list
wxPython to build an HTML analyser/displayer?
Hi, Currently, I use filters in Privoxy followed by a JavaScript embedded script to further filter a web page that is restricted to IE (because of incompatibilities of the DOM), and was wondering if it'd be feasible to write a Python GUI app with wxPython that would do the same, ie. fetch a web page, analyse its contents and filter/rewrite, before displaying it in a HTML renderer? Does wxWidgets offer an HTML displayer widget, and is it good enough? Thank you Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Win32 Silent Install
On Wed, 01 Dec 2004 17:15:38 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: >You are right about ActiveState, the copy you download from their web >site is licensed to prohibit redistribution. They might be prepared to >cut you a special license, but you'd have to ask them about that. Does it mean it's not allowed to build an application with ActiveState Python, and generate an installer that installs the whole thing, forcing users to go to ActiveState's web site and download the interpreter? Gee, that changes everything... Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython to build an HTML analyser/displayer?
On Wed, 1 Dec 2004 16:57:45 -0800, "Roger Binns" <[EMAIL PROTECTED]> wrote: (snip) Thx the links. Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Best GUI for small-scale accounting app?
On 20 Dec 2004 13:28:02 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: >Babelfish gave up on "durchzuwursteln" and so did I -- >"through-to-sausage-???" This is getting erotic ;-) Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tricks to install/run Python on Windows ?
On Sun, 26 Dec 2004 19:43:24 +0100, StepH <[EMAIL PROTECTED]> wrote: >What's wrong ? Python seems terific, but the tools... You could uninstall both Python and PyWin32 a.k.a. PythonWin, and install ActiveState Python which includes both in one tool. Then, check if the PythonWin IDE works fine. Luke. -- http://mail.python.org/mailman/listinfo/python-list
Re: Best GUI for small-scale accounting app?
On Tue, 28 Dec 2004 20:06:57 -0500, Ed Leafe <[EMAIL PROTECTED]> wrote: >That's where Paul and I came from, and that was our initial motivation >for deciding to develop Dabo - there wasn't a Python tool out there >that could even begin to approach what we were used to with VFP. Interesting discussion. I haven't looked at Dabo yet, but the issues that must be solved before Python is a valid alternative to proprietary solutions like Delphi or VB are: - speed where it matters (ie. no 20s load time) - good RAD (IDE and GUI designer, on par with Delphi or VB) - high-quality, varied widgets - good DB connectors - reasonable footprint (ie. no 20MB program just for a small appplication; have mercy on users stuck with P3 and dial-up) - ease of deployment and maintenance (ie. how easy is it for an application to launch some updated that will fetch updates from the web) If Dabo can do all this, it could be a great solution to all those people Delphi/VFP/VB users whether to go .Net. Luke. -- http://mail.python.org/mailman/listinfo/python-list
Flag control variable
hello, i'd like to know how to set up a flag to change a variable, for example, i want a simple script to combine 2 numbers, sum = num + another_num print "Now the sum of the numbers equals : ", sum how could i make it so that if i type python ./script.py 21 41 that i get the sum of 21 and 41 ? luke -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Thanks a lot -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
when expandig the script to multiple calcs i got a problem >>> a = 32 >>> c = 51 >>> sign = * File "", line 1 sign = * ^ SyntaxError: invalid syntax is there a way of adding * without quoting marks, because if you do it just soms the arguments -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
well i'm trying something else but no luck : #!bin/bash/python import sys import os a = int(sys.argv[1]) sign = (sys.argv[2]) b = int(sys.argv[3]) if sign == '+': sum = a + b print a, sign, b, "=", a + b command1 = "sudo mpg321 'http://translate.google.com/translate_tts?tl=en&q=%s_plus%s_equals%s'" % (a, b, sum) os.system (command1) elif sign == "*": sum = a * b print a, sign, b, "=", a * b command1 = "sudo mpg321 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" % (a, b, sum) when using * i get Traceback (most recent call last): File "./math+.py", line 6, in b = int(sys.argv[3]) ValueError: invalid literal for int() with base 10: 'Adafruit-Raspberry-Pi-Python-Code' i don't understand why b is a problem, it works fine with + -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 19:55:59 UTC+1 schreef Gary Herron: > On 02/11/2014 10:37 AM, luke.gee...@gmail.com wrote: > > > well i'm trying something else but no luck : > > > > > > #!bin/bash/python > > > import sys > > > import os > > > a = int(sys.argv[1]) > > > sign = (sys.argv[2]) > > > b = int(sys.argv[3]) > > > > > > if sign == '+': > > >sum = a + b > > >print a, sign, b, "=", a + b > > >command1 = "sudo mpg321 > > 'http://translate.google.com/translate_tts?tl=en&q=%s_plus%s_equals%s'" % > > (a, b, sum) > > >os.system (command1) > > > > > > elif sign == "*": > > >sum = a * b > > >print a, sign, b, "=", a * b > > >command1 = "sudo mpg321 > > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" % > > (a, b, sum) > > > > > > when using * i get > > > > > > Traceback (most recent call last): > > >File "./math+.py", line 6, in > > > b = int(sys.argv[3]) > > > ValueError: invalid literal for int() with base 10: > > 'Adafruit-Raspberry-Pi-Python-Code' > > > > > > i don't understand why b is a problem, it works fine with + > > > > Look at the error message. Carefully! It says, quite clearly, the call > > to int is being passed a string "Adafruit-Raspberry-Pi-Python-Code", > > which of course can't be converted to an integer. > > > > Now the question is how you ran the program in such a manner that > > sys.argv[3] has such an odd value. > > What does your command line look like? You didn't tell us, but that's > > where the trouble is. > > > > Gary Herron how do you meen "what does your command line look like?" -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 19:51:40 UTC+1 schreef Peter Otten: > luke.gee...@gmail.com wrote: > > > > > well i'm trying something else but no luck : > > > > > > #!bin/bash/python > > > > Hm. > > > > > import sys > > > import os > > > > For debugging purposes put the line > > > > print sys.argv > > > > here to see what arguments are passed to the script. When you type > > > > $ python script.py 2 * 2 > > > > in the shell the "*" sign is replaced with all items in the current > > directory. To avoid that you have to escape, i. e. prepend a backslash: > > > > $ python script.py 2 \* 2 > > > > To illustrate: > > > > $ touch one two three > > $ ls > > one three two > > $ python -c 'import sys; print sys.argv' 2 + 2 > > ['-c', '2', '+', '2'] > > $ python -c 'import sys; print sys.argv' 2 * 2 > > ['-c', '2', 'one', 'three', 'two', '2'] > > $ python -c 'import sys; print sys.argv' 2 \* 2 > > ['-c', '2', '*', '2'] > > > > > a = int(sys.argv[1]) > > > sign = (sys.argv[2]) > > > b = int(sys.argv[3]) > > > > > > if sign == '+': > > > sum = a + b > > > print a, sign, b, "=", a + b > > > command1 = "sudo mpg321 > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_plus%s_equals%s'" > > > % (a, b, sum) os.system (command1) > > > > > > elif sign == "*": > > > sum = a * b > > > print a, sign, b, "=", a * b > > > command1 = "sudo mpg321 > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" > > > % (a, b, sum) > > > > > > when using * i get > > > > > > Traceback (most recent call last): > > > File "./math+.py", line 6, in > > > b = int(sys.argv[3]) > > > ValueError: invalid literal for int() with base 10: > > > 'Adafruit-Raspberry-Pi-Python-Code' > > > > > > i don't understand why b is a problem, it works fine with + when using python script.py 2 \* 2 i get Traceback (most recent call last): File "math2.py", line 5, in sign = int(sys.argv[2]) ValueError: invalid literal for int() with base 10: '*' -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 20:01:05 UTC+1 schreef luke@gmail.com: > Op dinsdag 11 februari 2014 19:51:40 UTC+1 schreef Peter Otten: > > > luke.gee...@gmail.com wrote: > > > > > > > > > > > > > well i'm trying something else but no luck : > > > > > > > > > > > > > > #!bin/bash/python > > > > > > > > > > > > Hm. > > > > > > > > > > > > > import sys > > > > > > > import os > > > > > > > > > > > > For debugging purposes put the line > > > > > > > > > > > > print sys.argv > > > > > > > > > > > > here to see what arguments are passed to the script. When you type > > > > > > > > > > > > $ python script.py 2 * 2 > > > > > > > > > > > > in the shell the "*" sign is replaced with all items in the current > > > > > > directory. To avoid that you have to escape, i. e. prepend a backslash: > > > > > > > > > > > > $ python script.py 2 \* 2 > > > > > > > > > > > > To illustrate: > > > > > > > > > > > > $ touch one two three > > > > > > $ ls > > > > > > one three two > > > > > > $ python -c 'import sys; print sys.argv' 2 + 2 > > > > > > ['-c', '2', '+', '2'] > > > > > > $ python -c 'import sys; print sys.argv' 2 * 2 > > > > > > ['-c', '2', 'one', 'three', 'two', '2'] > > > > > > $ python -c 'import sys; print sys.argv' 2 \* 2 > > > > > > ['-c', '2', '*', '2'] > > > > > > > > > > > > > a = int(sys.argv[1]) > > > > > > > sign = (sys.argv[2]) > > > > > > > b = int(sys.argv[3]) > > > > > > > > > > > > > > if sign == '+': > > > > > > > sum = a + b > > > > > > > print a, sign, b, "=", a + b > > > > > > > command1 = "sudo mpg321 > > > > > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_plus%s_equals%s'" > > > > > > > % (a, b, sum) os.system (command1) > > > > > > > > > > > > > > elif sign == "*": > > > > > > > sum = a * b > > > > > > > print a, sign, b, "=", a * b > > > > > > > command1 = "sudo mpg321 > > > > > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" > > > > > > > % (a, b, sum) > > > > > > > > > > > > > > when using * i get > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > File "./math+.py", line 6, in > > > > > > > b = int(sys.argv[3]) > > > > > > > ValueError: invalid literal for int() with base 10: > > > > > > > 'Adafruit-Raspberry-Pi-Python-Code' > > > > > > > > > > > > > > i don't understand why b is a problem, it works fine with + > > > > when using python script.py 2 \* 2 > > i get > > > > Traceback (most recent call last): > > File "math2.py", line 5, in > > sign = int(sys.argv[2]) > > ValueError: invalid literal for int() with base 10: '*' i found it int(sys.argv[2]) should be sys.argv[2] is there a way i can do python ./script.py 3 * 3 instead of python ./script 3 \* 3 ? -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op dinsdag 11 februari 2014 20:28:44 UTC+1 schreef Tim Chase: > On 2014-02-11 11:06, luke.gee...@gmail.com wrote: > > > > > > command1 = "sudo mpg321 > > > > > > > > > > > > > > > > > > > > > > > > 'http://translate.google.com/translate_tts?tl=en&q=%s_times%s_equals%s'" > > > > > > > > > > > 1) PLEASE either stop using Google Groups or take the time to remove > > the superfluous white-space you keep adding to your posts/replies > > > > 2) you shouldn't need to use "sudo" to play sounds. That's just a > > bad practice waiting for trouble. > > > > -tkc its one rule in the original (at least on my computer) -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
hey, i got another problem now, if i use the imterpreter to do 3 * 4 it gives twelve the script gives ? any tips -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Would it be possible to make an int(sys.argv[1]) Not needed and set value 0 ( or in another script 1) For example a = int(sys.argv[1]) b = int(sys.argv[2]) c = int(sys.argv[3]) And I run Python ./script.py 2 3 It just set c automaticly to 0 or 1 Luke (PS thanks for the quick help) -- https://mail.python.org/mailman/listinfo/python-list
Python Advanced Help
Okay, So basically I created a python script around 1 year ago to grab an explain_plan from a Greenplum system (Normal SQL) and change it around and explain each step/section, the thing is, I've came back to the python code and I don't understand anything of what it's doing (the code specifically). The Script does work but I just want to explain each section to myself and understand it a bit more as I've forgot Python. This means putting comments/notes in next to each section to explain it but hidden so it doesn't show up when ran, so using the # commenting out #. The aim of the script is to make the explain_plan understandable because it comes out all garbled, so i've turned it upside down because thats how you read it, it goes from bottom to top instead of the default top to bottom. I've put step 1/2 in etc... but I want to know in the code what does what and where etc so I can then expand on the explanation of the explain_plan. Code (Python) - http://pastebin.com/sVhW34fc (This is the one I'm trying to understand) Before & After of an Explain_Plan in SQL Greenplum - http://pastebin.com/81kNWVcy What we're aiming for (Teradatas Explain_Plan) - http://pastebin.com/Nm4g12B3 Regards, Luke Charlton Technical Consultant [cid:4BEA1319-4F97-4ED8-96FE-1A3EDF7DEC22] lcharl...@vldbsolutions.com<mailto:lcharl...@vldbsolutions.com> Mobile : +44 (0) 773 431 3140 -- https://mail.python.org/mailman/listinfo/python-list
How to use the .isalpha() function correctly
Here a very small program that I wrote for Codecademy. When I finished, Codecademy acted like it was correct, but testing of this code revealed otherwise. -- print 'Welcome to the Pig Latin Translator!' # Start coding here! raw_input("Enter a word:") original = str(raw_input) if len(original) > 0 and original.isalpha(): print original else: print "empty" -- No matter what I type in, the result is "empty." What do I need to do in order for it to accept words? -- https://mail.python.org/mailman/listinfo/python-list
Re: Run Programming ?????
On Friday, December 12, 2014 4:40:01 AM UTC-8, Delgado Motto wrote: > I travel alot, if not just interested in things of pocketable portability, > and was curious if you can tell me if Python can be LEARNED from beginner on > an IOS device ( with interest of being able to test my code, possibly even if > a free website is capable of reviewing scripts ) but if not then I prefer if > you can suggest a language that can be used from such a machine. My ultimate > goal is to be able to create web pages and internet bots capable of searching > specific things for me, simply to save me time in my day as little as > crawling Youtube for a song that fails to be uploaded or other related > examples. Please advise me. Thanks. Yes, you can learn and write Python on iOS. There are several apps for this. Here are some websites to look at: http://pythonforios.com/ https://itunes.apple.com/us/app/pythonista/id528579881?mt=8 http://kivy.org/#home https://itunes.apple.com/us/app/python-3.2-for-ios/id519319292?mt=8 Codecademy: Code Hour I don't know how well these work, but since there are so many, I am assuming at least a couple are decent. I included Codecademy at the end just in case you need to review some basic syntax, but I'm not sure if you'll need it. Luke Tomaneng -- https://mail.python.org/mailman/listinfo/python-list
Re: Run Programming ?????
On Sunday, December 14, 2014 9:24:54 AM UTC-8, Luke Tomaneng wrote: > On Friday, December 12, 2014 4:40:01 AM UTC-8, Delgado Motto wrote: > > I travel alot, if not just interested in things of pocketable portability, > > and was curious if you can tell me if Python can be LEARNED from beginner > > on an IOS device ( with interest of being able to test my code, possibly > > even if a free website is capable of reviewing scripts ) but if not then I > > prefer if you can suggest a language that can be used from such a machine. > > My ultimate goal is to be able to create web pages and internet bots > > capable of searching specific things for me, simply to save me time in my > > day as little as crawling Youtube for a song that fails to be uploaded or > > other related examples. Please advise me. Thanks. > > Yes, you can learn and write Python on iOS. There are several apps for this. > > Here are some websites to look at: > http://pythonforios.com/ > https://itunes.apple.com/us/app/pythonista/id528579881?mt=8 > http://kivy.org/#home > https://itunes.apple.com/us/app/python-3.2-for-ios/id519319292?mt=8 > Codecademy: Code Hour > > I don't know how well these work, but since there are so many, I am assuming > at least a couple are decent. > > I included Codecademy at the end just in case you need to review some basic > syntax, but I'm not sure if you'll need it. > > Luke Tomaneng Sorry, I didn't include the actual link for Codecademy. Here you go: https://itunes.apple.com/us/app/codecademy-code-hour/id762950096?mt=8 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to use the .isalpha() function correctly
On Sunday, December 14, 2014 9:27:14 AM UTC-8, Chris Warrick wrote: > On Sun, Dec 14, 2014 at 6:16 PM, Luke Tomaneng wrote: > > Here a very small program that I wrote for Codecademy. When I finished, > > Codecademy acted like it was correct, but testing of this code revealed > > otherwise. > > -- > > print 'Welcome to the Pig Latin Translator!' > > > > # Start coding here! > > raw_input("Enter a word:") > > original = str(raw_input) > > if len(original) > 0 and original.isalpha(): > > print original > > else: > > print "empty" > > -- > > No matter what I type in, the result is "empty." What do I need to do in > > order for it to accept words? > > -- > > https://mail.python.org/mailman/listinfo/python-list > > That's not where the error is, actually. You are: > > 1. taking input with "Enter a word: " and NOT SAVING IT > 2. setting original to a string representation of the function > `raw_input`, which is something like > > >>> str(raw_input) > '' > > The correct way to do this is: > > original = raw_input("Enter a word: ") > > as raw_input already outputs a string. > > -- > Chris Warrick <https://chriswarrick.com/> > PGP: 5EAAEA16 Thanks very much. I'm not sure how I missed that, since I've used the exact same method you mentioned before. You've been very helpful. -- https://mail.python.org/mailman/listinfo/python-list
Program calling unwanted functions
Hello to all those in this forum, My code seems to have a mind of its own. I have been writing a program to reenact the "Twenny Wun" Vine video, and it seems to be activating functions without me calling them. Here is the script: def kid(): print "Cameraman: You stupid." kid1 = raw_input("Kid: ") if kid1.lower() == "no im not" or kid1.lower() == "no i'm not.": print "Cameraman: What's nine plus ten?" kid2 = raw_input("Kid: ") if kid2.lower() == "twenny wun" or kid2.lower() == "twenty-one" or kid2.lower() == "twenty one" or kid2 == "21" or kid2.lower() == "twenny one": print """Cameraman: You stupid. Ending program... """ else: print "That is not the right quote." kid() else: print "That is not the right quote." kid() def cameraman(): cameraman1 = raw_input("Cameraman: ") if cameraman1.lower() == "you stupid": print "Kid: No I'm not." cameraman2 = raw_input("Cameraman: ") if cameraman2.lower() == "whats 9 + 10" or cameraman2.lower() == "whats nine plus ten": print "Kid: Twenny wun" cameraman3 = raw_input("Cameraman: ") if cameraman3.lower() == "you stupid": print "Ending program..." time.sleep(2) else: print "That is not the right quote." cameraman() else: print "That is not the right quote." cameraman() else: print "That is not the right quote." cameraman() def perspective(): perspective_request = raw_input("Do you want to be the cameraman or the kid? (type the one you want): ") if perspective_request == "cameraman": cameraman() if perspective_request == "kid": kid() else: print "Invalid input." perspective() def instructions(): instructions_request = raw_input("Do you want instructions? (type 'yes' or 'no' without the quotes): ") if instructions_request == "no": perspective() if instructions_request == "yes": print "This is a reenactment of the 'Twenny Wun' Vine. You can type in the empty space to the right of each ':,' then press [return]. Don't use punctuation." perspective() else: print "Invalid input." instructions() instructions() The "cameraman" function restarts itself when it ends, and the "kid" function calls "instructions()." Does anyone know why? -- https://mail.python.org/mailman/listinfo/python-list
Concerning Dictionaries and += in Python 2.x
I have been having a bit of trouble with the things mentioned in the title. I have written the following script for a Codecademy course: stock = { "banana": 6, "apple": 0, "orange": 32, "pear": 15 } prices = { "banana": 4, "apple": 2, "orange": 1.5, "pear": 3 } def compute_bill(food): total = 0 for item in food: if stock[item] > 0: total += prices[item] stock[item] = stock[item] - 1 return total Whenever I run this script, "4" is returned. It does not seem to matter what in in the list the script is run on. I have tried this on the Codecademy interpreter/emulator (I'm not sure which they use) and the repl.it interpreter, but for the same result. If anyone could find the glitch in my code, please let me know. Thanks! -- https://mail.python.org/mailman/listinfo/python-list
Random ALL CAPS posts on this group
Has anyone noticed these? There have been about three of them recently and they don't seem to have anything to do with Python at all. Does anyone know if there is a good reason they are here? -- https://mail.python.org/mailman/listinfo/python-list
Re: Concerning Dictionaries and += in Python 2.x
On Monday, January 19, 2015 at 4:21:58 PM UTC-8, Chris Angelico wrote: > On Tue, Jan 20, 2015 at 11:12 AM, Luke Tomaneng wrote: > > def compute_bill(food): > > total = 0 > > for item in food: > > if stock[item] > 0: > > total += prices[item] > > stock[item] = stock[item] - 1 > > return total > > Whenever I run this script, "4" is returned. It does not seem to matter > > what in in the list the script is run on. I have tried this on the > > Codecademy interpreter/emulator (I'm not sure which they use) and the > > repl.it interpreter, but for the same result. If anyone could find the > > glitch in my code, please let me know. Thanks! > > > > In Python, indentation determines block structure. Have another look > at this function, and see if you can figure out where the problem is; > hint: try printing something out every time you claim a piece of > stock. > > ChrisA Hm. I fixed the indentation like you said, and it worked fine. The only reason I changed the indentation to what you saw in the first place is because Codecademy's Python engine registered an error. However, repl.it accepted the script. I have concluded that the original mistake was actually on the Codecademy site instead of my script. Thanks for helping me out. -- https://mail.python.org/mailman/listinfo/python-list
Re: Concerning Dictionaries and += in Python 2.x
Thanks Chris / Mr. Angelico / whatever you prefer. I attempted to post a reply to you before but it could not be viewed even after refreshing several times. You've been helpful. -- https://mail.python.org/mailman/listinfo/python-list
__pycache__
I am in school and there is a problem with my code: When I try to run my code in the python code in the python shell it waits about 10 seconds then shows an error that says “IDLE’s subprocess didn’t make connection. Either IDLE can’t start a subprocess or personal firewall software is blocking the connection.” Then when I press OK it just closes. P.S: My code is encrypting and decrypting using an offset factor. -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Can I make it that if C = int(sys.argv[3]) But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op woensdag 12 februari 2014 06:23:14 UTC+1 schreef Dave Angel: > luke.gee...@gmail.com Wrote in message: > > > Can I make it that if > > > C = int(sys.argv[3]) > > > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 > > > > > > > Why do you ask for 'automatically'? You're the programmer, write > > the test in the code. > > > > if len (sys.argv) == 3: > > sys.argv. append ("0") > > > > But of course there are lots of other things you need to check, > > so consider all of them at the same time. > > > > -- > > DaveA then i keep getting IndexError: list index out of range anyway to prevent it and just set the value to 0? -- https://mail.python.org/mailman/listinfo/python-list
Re: Flag control variable
Op woensdag 12 februari 2014 17:10:36 UTC+1 schreef Alain Ketterlin: > luke.gee...@gmail.com writes: > > > > > Can I make it that if > > > C = int(sys.argv[3]) > > > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 > > > > C = int(sys.argv[3]) if len(sys.argv) > 3 else 0 > > > > is one possibility. > > > > -- Alain. thanks a lot -- https://mail.python.org/mailman/listinfo/python-list
decimal numbers
hello, i have been working on a python resistor calculator to let my class show what you can do with python. now i have a script that makes the more speekable value of the resistance (res) #if len(str(res)) > 9: # res2 = res / 10 # print "de weerstand is %s,%s giga ohms" % (res2) #elif len(str(res)) > 6: # res2 = res / 100 # print "de weerstand is %s,%s Mega ohm" % (res2) #elif len(str(res)) > 3: # res2 = res / 1000 # print "de weerstand is", res2,"kilo ohm" #elif len(str(res)) < 4: # res2 = res # print "de weerstand is", res2,"ohm" i commented it because it doesn't work (yet), when i have a resistance of 9.9 Giga ohms it says it is 9 giga ohms. it seems to work with natural number, anyway of using decimals insted so that it says : the resistance is 9.9 Giga Ohms instead of 9 ? -- https://mail.python.org/mailman/listinfo/python-list
Re: decimal numbers
Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > hello, > > i have been working on a python resistor calculator to let my class show what > you can do with python. > > now i have a script that makes the more speekable value of the resistance > (res) > > > > #if len(str(res)) > 9: > > # res2 = res / 10 > > # print "de weerstand is %s,%s giga ohms" % (res2) > > #elif len(str(res)) > 6: > > # res2 = res / 100 > > # print "de weerstand is %s,%s Mega ohm" % (res2) > > #elif len(str(res)) > 3: > > # res2 = res / 1000 > > # print "de weerstand is", res2,"kilo ohm" > > #elif len(str(res)) < 4: > > # res2 = res > > # print "de weerstand is", res2,"ohm" > > > > i commented it because it doesn't work (yet), when i have a resistance of > > 9.9 Giga ohms it says it is 9 giga ohms. it seems to work with natural > number, anyway of using decimals insted so that it says : the resistance is > 9.9 Giga Ohms instead of 9 ? , wait i have put one %s to much in the print function. this is from a other attempt so please excuse me -- https://mail.python.org/mailman/listinfo/python-list
Re: decimal numbers
Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman: > "Luke Geelen" wrote in message > > news:ec88852e-1384-4aa5-834b-85135be94...@googlegroups.com... > > > Op zaterdag 15 februari 2014 10:18:36 UTC+1 schreef Luke Geelen: > > > hello, > > > > > > i have been working on a python resistor calculator to let my class show > > > what you can do with python. > > > > > > now i have a script that makes the more speekable value of the resistance > > > (res) > > > > > [...] > > > > > > i commented it because it doesn't work (yet), when i have a resistance of > > > > > > 9.9 Giga ohms it says it is 9 giga ohms. it seems to work with natural > > > number, anyway of using decimals insted so that it says : the resistance > > > is 9.9 Giga Ohms instead of 9 ? > > > > > > > You don't say which version of python you are using. > > > > If you are using python2, an integer divided by an integer always returns an > > integer - > > > > >>> 10/3 > > 3 > > > > It was changed in python3 to return a float - > > > > >>> 10/3 > > 3.3335 > > > > You can reproduce the python3 behaviour in python2 by adding a 'future' > > directive - > > > > >>> from __future__ import division > > >>> 10/3 > > 3.3335 > > > > HTH > > > > Frank Millman how (and where) would i add this rule into a script? by import or the calculation? -- https://mail.python.org/mailman/listinfo/python-list
Re: decimal numbers
If i do set form thing in my script i get Invalide syntax pointing at the last word of the form rule -- https://mail.python.org/mailman/listinfo/python-list
Re: decimal numbers
Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: > On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > > > If i do set form thing in my script i get > > > Invalide syntax pointing at the last word of the form rule > > > > Please copy and paste the exact code you ran along with the full text > > of the exception into your post. Paraphrasing it like this doesn't > > help us help you. sorry i made a typo its fixed, thanks a lot -- https://mail.python.org/mailman/listinfo/python-list
Re: decimal numbers
Op zaterdag 15 februari 2014 18:42:51 UTC+1 schreef Luke Geelen: > Op zaterdag 15 februari 2014 18:23:20 UTC+1 schreef Ian: > > > On Sat, Feb 15, 2014 at 10:17 AM, Luke Geelen wrote: > > > > > > > If i do set form thing in my script i get > > > > > > > Invalide syntax pointing at the last word of the form rule > > > > > > > > > > > > Please copy and paste the exact code you ran along with the full text > > > > > > of the exception into your post. Paraphrasing it like this doesn't > > > > > > help us help you. > > > > sorry i made a typo its fixed, thanks a lot hey, is it possible to remove the .0 if it is a valua without something behind the poit (like 5.0 gets 5 but 9.9 stays 9.9 -- https://mail.python.org/mailman/listinfo/python-list
Python Requirements
> Dear Python-List > > As part of my A2 Computing coursework, I need to program a solution using > Python 3.4. I also need to document the minimum requirements to run Python > 3.4 on a Windows machine, including minimum RAM, minimum processing power, > minimum hard disk space and monitor resolution. > > I have searched the Python forums and website, but I was unable to find > these requirements. > > Could you please send me a copy of these requirements for use in my > coursework? > > Thank you for your response in advance, > > Luke Harrison > A2 Computing Student -- https://mail.python.org/mailman/listinfo/python-list
Re: Reference Variables In Python Like Those In PHP
Chaos wrote: > Is It possible to have reference variables like in PHP ... > Is this available in python? You should note that, to a nearest equivalent, all variables are reference variables in Python. The difference is in what assignment does - += in Python does an assignment of a new object for immutable objects. For mutable objects like lists, += does an in place modification. x = 1 y = x # y and x now point to the same object y += 1 # not any more, because ints are immutable, # and += is defined not to mutate for ints Luke -- http://mail.python.org/mailman/listinfo/python-list
Seg fault in python extension module
Hello, I am working on my first python module based on a c program. The module builds and installs OK using dist-utils, and imports fine into python. However, when I try and use the one wrapper ("modgl.glVertex4f(1, 2, 3, 1)") in the module, it seg faults. Can anyone spot why this isn't working, or recommend a way to debug these things. Thanks, Luke #include static PyObject *_wrap_glVertex4f(PyObject *self, PyObject *args) { PyObject *resultobj = NULL; float arg1 ; float arg2 ; float arg3 ; float arg4 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; if(!PyArg_ParseTuple(args,(char *)":glVertex4f",&obj0,&obj1,&obj2,&obj3)) goto fail; { arg1 = (float)(PyFloat_AsDouble(obj0)); } { arg2 = (float)(PyFloat_AsDouble(obj1)); } { arg3 = (float)(PyFloat_AsDouble(obj2)); } { arg4 = (float)(PyFloat_AsDouble(obj3)); } glVertex4f(arg1,arg2,arg3,arg4); Py_INCREF(Py_None); resultobj = Py_None; return resultobj; fail: return NULL; }; static PyMethodDef modglMethods[] = { { (char *)"glVertex4f", _wrap_glVertex4f, METH_VARARGS, NULL}, { NULL, NULL, 0, NULL } }; PyMODINIT_FUNC modgl(void) { (void) Py_InitModule("modgl", modglMethods); }; int main(int argc, char *argv[]) { /* Pass argv[0] to the Python interpreter */ Py_SetProgramName(argv[0]); /* Initialize the Python interpreter. Required. */ Py_Initialize(); /* Add a static module */ initmodgl(); return 0; }; -- http://mail.python.org/mailman/listinfo/python-list
Re: Detupleize a tuple for argument list
Marco Wahl wrote: > Hi, > > I want to give a tuple to a function where the function > expects the respective tuple-size number of arguments. ... > One way to do what I want is--of course--to call > foo(t[0], t[1]). My actual question is if there is a > smarter way to do it. Yes, just this: foo(*t) Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: Python on handhelds
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Nick" <[EMAIL PROTECTED]> writes: >> I have never programmed in Python a day in my life. My group is working >> on developing an application on the Dell Axim hand held that has a >> tight deadline. I have heard that Python is particularly advantageous >> in rapid prototyping and deployment. I would like to lean this way if I >> can. Does anyone know if I can run Python on the Dell Axim handheld. It >> runs Windows CE. If so, what all is needed to make this possible. > > Someone did a WinCE port a while back, but I don't think it's actively > used much. The approach might be reasonable if you're an expert with > some time on your hands, but for a newcomer with an onrushing > deadline, you may be better off using whatever you're already using > (VB or whatever), and keeping Python in mind for some future project. I agree that it is much less active than Python on other platforms, and in some areas it lags behind the PC, e.g. in GUI toolkits. However, if you want to try it go here: http://sourceforge.net/projects/pythonce See also the mailing list: http://mail.python.org/mailman/listinfo/pythonce Luke Dunstan -- http://mail.python.org/mailman/listinfo/python-list
Re: make a class instance from a string ?
Bo Yang wrote: > I know in java , we can use > > class.ForName("classname") > > > to get an instance of the class 'classname' from a > string , in python , how do I do that ? In Python, classes are first class objects, so normally you would pass the class itself around, rather than use the names of classes. Of course that might not be practical or applicable in your situation. Luke -- http://mail.python.org/mailman/listinfo/python-list
Correct abstraction for TK
I'm looking for a good example of how to correctly abstract TK code from the rest of my program. I want to just get some user info and then get 4 values from the GUI. Right now I've written it OOP per the examples on python.org but it doesn't seem to be meshing very well with the rest of my project. Can anyone suggest some examples so that I can get more ideas? Thanks, Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: Correct abstraction for TK
Thanks for all the suggestions guys. I'm realizing that I need to chose more of a specific paradigm. With closures, I was able to stay away from unneeded classes before but Tk brings it to a whole other level. Thanks again, Luke On Jul 3, 2:50 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > I'm looking for a good example of how to correctly abstract TK code > > from the rest of my program. I want to just get some user info and > > then get 4 values from the GUI. Right now I've written it OOP per the > > examples on python.org but it doesn't seem to be meshing very well > > with the rest of my project. > > Simplest: just have gui operations call the application code. The > application main loop is just the gui event loop. Example (first tk > program I ever wrote, and one of my first python programs): > >http://www.nightsong.com/phr/python/calc.py > > That might be enough for what you're doing. > > Fancier: put gui in separate thread. Be careful, it's not reentrant; > all communication with the application has to be through queues, sort > of like writing a miniature web server. Most straightforward is to > pass tuples like (function, args, **kwargs) through the queues, where > the opposite end invokes the function on the arg list. There are some > recipes in the Python cookbook for triggering the event loop on a > periodic timeout from inside tkinter. > > See also "model-view-controller" for a more complex design approach > intended to separate the interface from the application logic. > > Finally, consider total separation by embedding an http server in the > application, so the gui is a web browser and you write a web app. > It's often easier to code a simple html interface than to mess with > the damn Tk widgets and trying to get them to look decent on the > screen, plus it lets you easily put the client on a remote machine, > support multiple clients simultaneously, etc. -- http://mail.python.org/mailman/listinfo/python-list
Re: [pygame] pyweek is happening august 02 - august 09
Laura Creighton wrote: > 00:00 UTC 2007-09-02 to 00:00 UTC 2007-09-09 exactly. See > www.pyweek.org > > PyconUK is happening. http://www.pyconuk.org/ 8th and 9th September. > > This means that those of us who generally do not see each other but are > going to PyconUK could put together an entry and then sprint together > on it before PyCon UK. There would be this terrible torment -- do > I attend the con or get my game to work -- but it is still the > best chance some of us have to work together yet. > > Talk to me if you are interested in maybe making a PyconUK pygame > team. I think that this could be a lot of fun. Sign up on > www.pyweek.org if you think so, as well. But mail me. > > John -- assuming we want to meet up _before_ PyConUK -- can that > work? Can you point us at a cheap hostel for a few days? > > Laura Creighton > Laura - Pyweek is happening the first week in September, not august. Thanks for giving me a good scare, thinking i missed the first half already! -- http://mail.python.org/mailman/listinfo/python-list
Re: [pygame] Re: Just bought Python in a Nutshell
Lamonte Harris wrote: > Wow I just got it, and its nice doesn't even look used god damn. :D. It's generally considered rude to curse in technical forums such as this. Also, please use more punctuation. You're hard to understand sometimes. -Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Is there some sort of Python Error log.
Lamonte Harris wrote: > Command prompt is a pain and it would be pretty nice to have this feature. If you're on windows, try using an IDE for your code editing. Then the errors will show up in the interactive shell that the IDE runs, and you won't have to deal with starting a DOS command prompt to catch your errors. -Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: Help! Identical code doesn't work in Wing IDE but does in Komodo.
> With the exact same line of code in Komodo I get the correct output > which is "Sample Feed" > > Any idea what's wrong? My guess would be different PYTHONPATHs. Try this on each: >>> import sys >>> print sys.path They might even be using different python versions - but both of these are just guesses. Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: hi,every body. a problem with PyQt.
> i use QT-designer to design application GUI. > now i save the test.ui file into e:\test\test.ui > next step,how can i run it? You should have a look at a PyQt tutorial, such as this one: http://vizzzion.org/?id=pyqt Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: code challenge: generate minimal expressions using only digits 1,2,3
I am teaching myself coding. No university or school, so i guess its homework if you like. i am interested in algorithms generally, after doing some of Project Euler. Of course my own learning process is best served by just getting on with it but sometimes you will do that while other times you might just choose to ask for help. if no one suggests then i will probably shelve it and come back to it myself when I'm fresh. no it's not a real world problem but my grounding is in math so i like pure stuff anyway. don't see how that is a problem, as a math person i accept the validity of pure research conducted just for curiosity and aesthetic satisfaction. it often finds an application later anyway Thanks for your helpful suggestion of trying other methods and i will do that in time. my motive was to share an interesting problem because a human of moderate math education can sit down with this and find minimal solutions easily but the intuition they use is quite subtle, hence the idea of converting the human heuristic into an algorithm became of interest, and particularly a recursive one. i find that the development of a piece of recursion usually comes as an 'aha', and since i hadn't had such a moment, i thought i'd turn the problem loose on the public. also i found no online reference to this problem so it seemed ripe for sharing. On Fri, Feb 20, 2009 at 3:39 PM, Nigel Rantor wrote: > Trip Technician wrote: > >> anyone interested in looking at the following problem. >> > > if you can give me a good reason why this is not homework I'd love to hear > it...I just don't see how this is a real problem. > > we are trying to express numbers as minimal expressions using only the >> digits one two and three, with conventional arithmetic. so for >> instance >> >> 33 = 2^(3+2)+1 = 3^3+(3*2) >> >> are both minimal, using 4 digits but >> >> 33 = ((3+2)*2+1)*3 >> >> using 5 is not. >> >> I have tried coding a function to return the minimal representation >> for any integer, but haven't cracked it so far. The naive first >> attempt is to generate lots of random strings, eval() them and sort by >> size and value. this is inelegant and slow. >> > > Wow. Okay, what other ways have you tried so far? Or are you beating your > head against the "search the entire problem space" solution still? > > This problem smells a lot like factorisation, so I would think of it in > terms of wanting to reduce the target number using as few operations as > possible. > > If you allow exponentiation that's going to be your biggest hitter so you > know that the best you can do using 2 digits is n^n where n is the largest > digit you allow yourself. > > Are you going to allow things like n^n^n or not? > > n > > > -- http://mail.python.org/mailman/listinfo/python-list
Re: code challenge: generate minimal expressions using only digits 1,2,3
yes power towers are allowed exponentiation, multiplication, division, addition and subtraction. Brackets when necessary but length is sorted on number of digits not number of operators plus digits. I always try my homework myself first. in 38 years of life I've learned only to do what i want, if I wanted everyone else to do my work for me I'd be a management consultant ! On Fri, Feb 20, 2009 at 3:52 PM, Luke Dunn wrote: > I am teaching myself coding. No university or school, so i guess its > homework if you like. i am interested in algorithms generally, after doing > some of Project Euler. Of course my own learning process is best served by > just getting on with it but sometimes you will do that while other times you > might just choose to ask for help. if no one suggests then i will probably > shelve it and come back to it myself when I'm fresh. > > no it's not a real world problem but my grounding is in math so i like pure > stuff anyway. don't see how that is a problem, as a math person i accept the > validity of pure research conducted just for curiosity and aesthetic > satisfaction. it often finds an application later anyway > > Thanks for your helpful suggestion of trying other methods and i will do > that in time. my motive was to share an interesting problem because a human > of moderate math education can sit down with this and find minimal solutions > easily but the intuition they use is quite subtle, hence the idea of > converting the human heuristic into an algorithm became of interest, and > particularly a recursive one. i find that the development of a piece of > recursion usually comes as an 'aha', and since i hadn't had such a moment, i > thought i'd turn the problem loose on the public. also i found no online > reference to this problem so it seemed ripe for sharing. > > On Fri, Feb 20, 2009 at 3:39 PM, Nigel Rantor wrote: > >> Trip Technician wrote: >> >>> anyone interested in looking at the following problem. >>> >> >> if you can give me a good reason why this is not homework I'd love to hear >> it...I just don't see how this is a real problem. >> >> we are trying to express numbers as minimal expressions using only the >>> digits one two and three, with conventional arithmetic. so for >>> instance >>> >>> 33 = 2^(3+2)+1 = 3^3+(3*2) >>> >>> are both minimal, using 4 digits but >>> >>> 33 = ((3+2)*2+1)*3 >>> >>> using 5 is not. >>> >>> I have tried coding a function to return the minimal representation >>> for any integer, but haven't cracked it so far. The naive first >>> attempt is to generate lots of random strings, eval() them and sort by >>> size and value. this is inelegant and slow. >>> >> >> Wow. Okay, what other ways have you tried so far? Or are you beating your >> head against the "search the entire problem space" solution still? >> >> This problem smells a lot like factorisation, so I would think of it in >> terms of wanting to reduce the target number using as few operations as >> possible. >> >> If you allow exponentiation that's going to be your biggest hitter so you >> know that the best you can do using 2 digits is n^n where n is the largest >> digit you allow yourself. >> >> Are you going to allow things like n^n^n or not? >> >> n >> >> >> > -- http://mail.python.org/mailman/listinfo/python-list
Vmware api
Hi List, Has anyone here played around with getting python to talk to the vmware api's. I have had a quick look at vmware's api and there is no out of the box python packages, but I believe that there might be some third party wrappers around? If anyone has any info that would be great. Thanks Regards, Luke Hamilton Solutions Architect RPM Solutions Pty Ltd Mobile: 0430 223 558 [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Web shopping carts
Hey People, I am wondering if there are any OS shopping cart application written in python? Regards, Luke Hamilton Solutions Architect RPM Solutions Pty. Ltd. Mobile: 0430 223 558 [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Web shopping carts
Thanks... Do you happen to have anymore details? > From: Tino Wildenhain <[EMAIL PROTECTED]> > Date: Wed, 10 Sep 2008 06:52:40 -0500 > To: Luke Hamilton <[EMAIL PROTECTED]> > Cc: "python-list@python.org" > Subject: Re: Web shopping carts > > Luke Hamilton wrote: >> Hey People, >> >> I am wondering if there are any OS shopping cart application written in >> python? >> > > Yes there are. > > HTH > Tino -- http://mail.python.org/mailman/listinfo/python-list
Re: Web shopping carts
> From: Tino Wildenhain <[EMAIL PROTECTED]> > Date: Wed, 10 Sep 2008 08:40:42 -0500 > To: Luke Hamilton <[EMAIL PROTECTED]> > Cc: "python-list@python.org" > Subject: Re: Web shopping carts > > Hi, > > Luke Hamilton wrote: >> Thanks... >> >> Do you happen to have anymore details? > > Yes well... you guess it was supposed to be a funny comment > but would you happen to have anymore details on your > requirements as well? Your simple question was just > asking for making fun of it. > It was actually meant to be a pretty general question. I was really trying to get a feel for what was out there, so I can then to start to have a look at there capabilities. > (Other than that please see the answer given by Fredrik) > And unfortunately Google hasn't been much help... > > Ah, btw, I'd check the the other posts of long term members > if you see something in the appearance different to > yours :-) (not related to your question itself) > > Cheers > Tino > > ... >>> Luke Hamilton wrote: >>>> Hey People, >>>> >>>> I am wondering if there are any OS shopping cart application written in >>>> python? >>>> >>> Yes there are. >>> >>> HTH >>> Tino >> >> > -- http://mail.python.org/mailman/listinfo/python-list
Re: Initializing defaults to module variables
Burton Samograd wrote: > My question is, how can I setup my program defaults so that they can > be overwritten by the configuration variables in the user file (and so > I don't have to scatter default values all over my code in try/catch > blocks)? The Django web framework happens to do something very like this. Instead of 'import config' you have to do 'from django.conf import settings', and you have an environment variable that allows you to specify the user settings file, but otherwise I think it is pretty much the same. The guts of the mechanism is here: http://code.djangoproject.com/browser/django/branches/magic-removal/django/conf/__init__.py It has quite a bit of custom Django stuff in there that you can ignore, but I think the principles should apply. Luke -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Commercial or Famous Applicattions.?
just off the top of my head... NASA uses it. Lots of games use Python as their game logic/scripting language (how many use PHP? probably approaching 0. LUA is more popular than Python but Python is much more popular than PHP). The first ever bittorrent client (the official one) was written in Python. The game Eve Online is written completely in Python. Youtube uses lots of Python, Facebook uses some. Reddit is written in Python as well. Google App Engine has both Python and Java interfaces. They don't have a PHP interface; I wonder why? Lots of jobs at Google (even Java jobs and such) require Python experience; they don't tend to require PHP experience too. Because PHP doesn't really teach you much. The syntax is not nearly as elegant. It's buggy and rough around the edges. They have gross workarounds for a lot of things that should be language features. That's not to say that Python's the only language that is better than PHP for most things. Ruby is also a good option. But these languages are both infinitely more flexible _right now_ (not based almost solely for web apps) and better to use for almost everything than PHP. PHP has its place, and part of the reason it still has that place is because a lot of web hosts haven't started hosting Python and Ruby frameworks in a scalable, fast way. But it's not the frameworks' fault. That's just my 2c. On Mon, Nov 8, 2010 at 6:18 PM, Jorge Biquez wrote: > Hello all. > > Newbie question. Sorry. > > Can you mention applications/systems/solutions made with Python that are > well known and used by public in general? ANd that maybe we do not know they > are done with Python? > > I had a talk with a friend, "PHP-Only-Fan", and he said (you know the schema > of those talks) that "his" language is better and that "just to prove it" > there are not too many applications done with Python than the ones done with > PHP and that "that of course is for something". That conversation , that by > the way I guess is useless at all , makes me thing the idea of ask of > applications done with Python. Not for debate the argument of that guy BUT > to learn what can be done with Python. In grphical interface, schemas of > jobs, etc. I know that there are tons of solutions but would like to hear of > possible about the ones you have used most or recommend the most. > > As an example, I love and have used in the last years MAILMAN, never > crashed, always works even on my small and old Intel Pentium III with a 10GB > hard disk and 640KB of RAM. Still working and will work for sure (running > under FreeBsd by the way). > > Thanks in advance for your comments. > > Jorge Biquez > > ___ > Tutor maillist - tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- http://mail.python.org/mailman/listinfo/python-list
Pyjamas 0.8.1~+alpha1 released
This is the 0.8.1~+alpha1 release of Pyjamas. Pyjamas comprises several projects, one of which is a stand-alone python-to-javascript compiler; other projects include a Graphical Widget Toolkit, such that pyjamas applications can run either in web browsers as pure javascript (with no plugins required) or stand-alone on the desktop (as a competitor to PyGTK2 and PyQT4). This announcement marks the beginning of the pyjamas 0.8.1 release candidates. Operating Systems, Browsers and Desktop Engines tested so far are listed here: http://code.google.com/p/pyjamas/issues/list Downloads are available from the usual places: http://pypi.python.org/pypi/Pyjamas https://sourceforge.net/projects/pyjamas/files/pyjamas/0.8.1/ Pyjamas is slowly converting to running its own infrastructure using pyjamas applications (which also operate as Desktop applications). This includes: * http://pyjs.org/pygit/ - a git repository viewer using python-git * http://lists.pyjs.org/mail/ - a list viewer using lamson's json archive * http://pyjs.org - a simple web engine using AJAX to get HTML pages * the wiki http://pyjs.org/wiki is next (using python-dulwich) The full source code of each of these applications is available and can be used for projects and purposes other than for pyjamas itself. The README is available here: http://pyjs.org/pygit/#file=README&id=0d4b6787d01c3d90f2c8801c5c4c45e34145bbdd&mimetype=text/plain -- http://mail.python.org/mailman/listinfo/python-list
[ANN] Pyjamas-Gitweb 0.1 released
http://pypi.python.org/pypi/Pyjamas-GitWeb/0.1 Pyjamas-Gitweb is a pure python git repository browser, comprising an independent JSONRPC back-end service written in 130 lines that can be used by any JSONRPC client (a python command-line example is included), and a front-end python (pyjamas) written in 350 lines. In combination with the back-end service, the front-end may either be compiled to javascript and used on the web or it may be run directly in python for use as a desktop git repository browser. in other words, it's not much to look at, but it's kinda cool and it does the job. here's a working demo where you can browse the source code with itself: http://pyjs.org/pygit/pygit.html?repo=pyjamasgitweb.git l. -- http://mail.python.org/mailman/listinfo/python-list
pyjamas 0.8.1 - help requested for testing to reach stable release
hi folks, got a small favour to ask of the python community - or, more specifically, i feel compelled to alert the python community to "a need" with which you may be able to help: we're due for another release, and it's becoming an increasingly-large task. given the number of examples requiring testing (75+) the number of browsers (15+) and desktop engines (3 so far, on 3 different OSes) that pyjamas supports is just... overwhelming for any one individual to even contemplate tackling. for the pyjamas 0.6 release, for example, i spent three weeks straight, just doing testing. from that experience i decided to set a rule, which is very straightforward: ask for help in testing, set a (reasonably firm) deadline for a release date, and then whatever has been tested by contributors by that time, that becomes the stable release. thus, in this way, the community receives a stable release that is of the quality that the *community* requires. the list of platforms tested already is quite long: however it's not long _enough_! and, also, on each task, there needs to be many more examples actually tested. here's what's been done so far: http://code.google.com/p/pyjamas/issues/list?can=2&q=milestone=Release0.8.1 we need more testing on opera, more testing on safari, more versions of firefox - more of everything basically! so, this is basically more of a "notification" than it is anything else, that if you'd like to help with the responsible task of ensuring that a python compiler and GUI toolkit has a release that the python community can be proud of, that i'm placing that responsibility directly into your hands: i'm just the gatekeeper, here. lastly, i'd like to leave you with this thought. i am doing a web site for a client (a general-purpose content management system which will be released as free software at some stage). the user management roles are stored as a comma-separated list in the database (kirbybase). i needed to split the string back into a list, and before i knew it i had typed this: import string roles = map(string.strip, user['roles'].split(",")) what struck me was that, although i've been working with pyjamas for over three years, it _still_ had me doing a double-take that this is *python*, yet this will end up running in *javascript* in the actual web site. the level of pain and awkwardness that would need to be gone through in order to do the same operation in javascript, and being completely unable to actually test and develop with confidence under pyjd directly at the python interpreter, i just... i can't imagine ever going back to that. and that's just... fricking awesome, but it highlights and underscores that there's a real reason why pyjamas is worthwhile helping out with (and using). you *do not* have to learn javascript, yet can still create comprehensive web sites that will work across all modern web browsers... *if* they're tested properly :) ok enough. thanks folks. l. -- http://mail.python.org/mailman/listinfo/python-list
pyjamas pyjs.org domain has been hijacked
i have an apology to make to the python community. about 3 or 4 months ago a number of the pyjamas users became unhappy that i was sticking to software (libre) principles on the pyjamas project. they saw the long-term policy that i had set, of developing python-based pyjamas-based infrastructure (such as pygit) for pyjamas to become a demonstration of its own technology, as being unnecessarily restrictive, and for their convenience, they requested the use of non-free hosting services such as github, google groups and so on. i patiently explained why this was not acceptable as i am software (libre) developer, and advised them that if they wanted such services, perhaps they could help themselves to learn pyjamas and python by helping to improve the existing infrastructure, and that i would be happy to help them do so. many of them did not understand or accept. what i did not realise was happening, until it was announced a few hours ago, was that in the intervening time a number of the pyjamas users had got together to develop alternative infrastructure which makes use of non-free hosting facilities such as github, and that they also planned to hijack the pyjs.org domain... *without* consulting the 650 or so members on the pyjamasdev mailing list, or the python community at large. so this is rather embarrassing because i had just put out a request for help to the wider python community, with the pyjamas 0.8.1 release, when it turns out that 12 hours later the domain has been hijacked. my first apology therefore is this: i apologise to the python community for being a cause of disruption. the second apology is - if priority can ever be applied to apologies at all - is i feel somewhat more important. i am a free (libre) software developer, and i am a teacher, as many of you will know from the talks that i have given on pyjamas at various conferences. i lead by example, and it is not just free software development itself that i teach, but also free software principles. this was why i set the long-term policy that pyjamas should migrate to running on python-based server infrastructure and pyjamas-based web front-end applications, *even* for its own development, because the most fundamental way to teach is to lead by example. my apology is therefore for the disruption caused to the pyjamas project - and to the python community - as a direct consequence of me wishing to uphold software (libre) principles, and for using the pyjamas project as a way to do that. that may sound incredibly strange, especially to those people for whom software (libre) principles are something that they just accept, but it is a genuine apology, recognising that there are people for whom free software principles are not of sufficient importance to have their day-to-day development made inconvenient. i don't know what else to say, so i'll leave it at that. sorry folks. l. -- http://mail.python.org/mailman/listinfo/python-list
Re: pyjamas pyjs.org domain has been hijacked
... i'm reeally really sorry about this, but it suddenly dawned on me that, under UK law, a breach of the UK's data protection act has occurred, and that the people responsible for setting up the hijacked services have committed a criminal offense under UK law. ordinarily, a free software mailing list would be transferred to alternative services through the process of soliciting the users to enter into an implicit contract over a legally-enforceable reasonable amount of time, as follows: "in 30 days we will move the mailing list. anyone who doesn't want their personal data moved to the new server please say so". unfortunately, in this case, i have to advise that no such announcement had been made. although i gave permission to one of the people who has hijacked the domain my permission to aid and assist in the administration of the server, i did NOT give them permission to do anything else. unfortunately, they then abused the trust placed in them in order to gain unauthorised access to the machine. in this way, the data (ssh keys and user's email addresses) was copied WITHOUT my express permission (constituting unauthorised computer access and misuse of a computer), but worse than that WITHOUT the permission of the users who "own" their data (ssh keys and email addresses). as it's 2am here in the UK and also i will be travelling for the next couple of days, and also to preserve the state of the machine as evidence, i have had to shut down the XEN instance and will not be in a convenient position to access the email addresses in order to directly notify the users of the UK Data Protection Act breach. so for now, this announcement (to the python list, of all places) will have to do. for which i apologise, again, for having to inconvenience others who may not be interested in what has transpired. but to all concerned i apologise again, deeply, for putting everyone to trouble just because i decided to stick to free software principles. strange as that sounds. i honestly didn't see this coming. l. -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about pyjamas inner workings (pyjd's version of imputil.py)
[i'm bcc'ing this to python-list because it's something that is generic to python, not pyjamas] On Tue, Jun 7, 2011 at 4:38 PM, Alexander Tsepkov wrote: > I'm working on a python-based side project where I want to be able to > generate multiple variations of the program and I really like the way > pyjamas handles this same problem with the browsers by pulling in variations > from __safari__, __ie6__, etc. It seems very elegant to just define the > actual functions that change rather than copy-pasting entire code and having > to maintain the same class in multiple places. One way I was thinking of > dealing with this is to use regular expressions to scan these functions and > classes, but I feel like there would be too many special cases with > indentations that I would need to address. I'm trying to understand the > mechanism by which pyjamas does this so I can apply something similar to my > python code. ok, then just use pyjd/imputil.py. it's a modified - bug-fixed - version of the "standard" version of the python imputil.py which has then been modified to include the "platform overrides" concept, as well. the problem(s) with the "standard" version of imputil.py include that it failed to perform the correct import operations as compared to standard built-in (c-code) python import behaviour. one of the very first things i had to do was to fix the bugs and broken behaviour in imputil.py the second important thing that i had to do was, to instead of looking up just the cached .pyc pre-compiled byte code file, but also look up the platform override pre-compiled byte code file... *and* also make sure that, if there existed a platform override .py file *and* the "original" / "base" .py file, the platform override bytecode was thrown away. i.e. it's a leetle more complex than just "let's look at the timestamp on the .pyc file, compare it to the timestamp of the .py file". for those people on python-list who may not be familiar with the platform overrides system in pyjamas, it's a fantastic concept where, instead of doing ridiculous amounts of "if platform == 'win32' do xyz elif platform == 'cygwin' do abc elif elif elif elif elif elif elif" [i'm sure you get the idea] you just have one "base" file e.g. compiler.py and then you have "overrides" compiler.win32.py or compiler.cygwin.py etc. etc. in these "overrides", you have classes with methods with the *exact* same name as in the "base" file, and the [heavily-modified] imputil.py performs an AST-level "merge" prior to byte-code compilation. the technique forces a clean and clear separation of an API from the functionality behind the API, with these overrides providing Object-Orientated design methodology at a base "system" level. l. -- http://mail.python.org/mailman/listinfo/python-list
[ann] pyjamas 0.8alpha1 release
after a long delay the pyjamas project - http://pyjs.org - has begun the 0.8 series of releases, beginning with alpha1: https://sourceforge.net/projects/pyjamas/files/pyjamas/0.8/ pyjamas is a suite of projects, including a python-to-javascript compiler with two modes of operation (roughly classified as "python strict" and "Optimised"); a GUI Framework almost identical to that of the GWT Project (1.5 to 1.7); and a "Desktop" version which is similar in concept to Adobe Air, allowing python applications to be run - unmodified - as stand-alone Desktop Applications. pyjamas can therefore be considered to be a Desktop GUI framework - a peer of GTK2 and QT4 - with the startling capability that applications can also be compiled to javascript and run in any modern web browser with absolutely no special plugins required, or it can be considered to be an AJAX Web Framework with the massive advantage that applications are written in python (not javascript) with a "Desktop" mode as well. both descriptions are accurate, making pyjamas the world's only free software python-based platform-independent, browser-independent, GUI-toolkit-independent and OS-independent "Holy Grail" GUI development environment [so there. nyer, nyer to the corporate big boys with access to $m who *still* haven't managed that one] also included are ports of GChart and GWTCanvas, each of which run under all web browsers and all desktop engines (with the exception at present of the python-webkit desktop engines, which presently do not support SVG Canvas). all pyjamas UI libraries are designed to be browser-independent as well as platform independent. the usual "browser foibles", tricks and gotchas are catered for with a transparent "Platform Override" mechanism which ensures that the published API of each UI Library is identical across all platforms (including the Desktop Engines). [no more "If Platform == IE or Platform == Opera"] due to the sheer number of modern browsers as well as the number of pyjamas-desktop engines required to be supported, the 0.8 series will be ready declared "stable" when sufficient community-led testing has been done. bugreports are in for Opera 11, IE8 and Google Chrome: http://code.google.com/p/pyjamas/issues/detail?id=600 http://code.google.com/p/pyjamas/issues/detail?id=601 http://code.google.com/p/pyjamas/issues/detail?id=597 still requiring testing and confirmation is Opera 9 and 10; Firefox 2, 3, 3.1, 3.5, 3.6 and 4.0; IE6, 7 and 9; Safari 3 and 4, as well as mobile phone browsers Android, Symbian Series 60, iphone, ipad and blackberry OS 4. also requiring testing and confirmation is the Desktop Engines, of which there are now four variants: XulRunner (Firefox Engine), pywebkitgtk, MSHTML and the new addition pywebkitdfb (DirectFB). each browser and each engine requires each of the 70 examples to be run, and in the case of the pyjamas compiler (pyjs), compilation is required with both -O and --strict (with the exception of the LibTest example). the pywebkitdfb engine is a new addition, and merits a particular mention. some time last year, both GTK2 and QT4 independently announced that they were dropping support for DirectFB from future versions, and Enlightenment had not tested the DirectFB port for some considerable time. Webkit-GTK with the older GTK-DirectFB libraries simply would not compile. in the embedded space, where it can take 30 seconds to fire up Webkit-GTK on a 400mhz ARM9 and even longer to start up WebkitQT4, this was something of a disaster. To fix this, a new port of Webkit was created which uses DirectFB directly, using a tiny 50k Widget Toolkit called "Lite". This development coincided with the re-engineering of pywebkitgtk and the creation of the pythonwebkit project, http://www.gnu.org/software/pythonwebkit: pywebkitdfb was therefore also created at the same time. Cutting a long story short, pywebkitdfb now exists and has a startup time on 400mhz ARM9 processors of under 1.5 seconds. The startup time of both WebkitDFB and pywebkitdfb on Dual-Core 2ghz Intel systems is so quick that it's difficult to determine: an estimate is under 0.1 seconds (100ms). WebkitGTK. WebkitEFL and WebkitQT4 have approximately 20 times or longer startup times. So although WebkitDFB is still significantly experimental, it is definitely worthwhile considering, especially for Embedded Systems, but even for use on X-Windows, and even just as a plain (but modern) web browser for those people sick to the back teeth of long startup times on their web browser [and it has python bindings, too. yaay!] summary: developing applications in pyjamas means the application can be made to run just about anywhere, and it's an entirely python-based and a free software framework. it's a community-driven project, so requires *your* input to get it to a proven stable state. http://pyjs.org -- http://mail.python.org/mailman/listinfo/python-list
Re: [ann] pyjamas 0.8alpha1 release
On Wed, May 4, 2011 at 3:06 PM, Luke Kenneth Casson Leighton wrote: > after a long delay the pyjamas project - http://pyjs.org - has begun the > 0.8 series of releases, beginning with alpha1: > > https://sourceforge.net/projects/pyjamas/files/pyjamas/0.8/ > > pyjamas is a suite of projects, including a python-to-javascript > compiler with two modes of operation (roughly classified as "python > strict" and "Optimised"); a GUI Framework almost identical to that of > the GWT Project (1.5 to 1.7); oh one other thing - for the 0.8 release, jim washington kindly added an HTML5-compliant "Drag-n-Drop" interface, which, on web engines that do not have HTML5, is emulated. and thus provides the exact same API, regardless of the web browser being used. cool, huh? if i was a java-lover, i'd look forward to that being added some day to GWT. btw - if anyone's at all curious [about GWT "Desktop" possibilities], there *does* exist a sort-of "Desktop" version [not really] - it's basically webkit, it requires execution under the eclipse IDE, and it's still javascript (not Java). i _did_ speak to the GWT Team, raising with them the possibility of doing Java bindings to Webkit [or XulRunner, or MSHTML] and providing a port of GWT that can run GWT applications REALLY as stand-alone Desktop applications, and they basically implied that that'll happen "when hell freezes over". i guess the idea of providing languages other than javascript with direct access to the full and incredible capabilities of DOM and HTML5 is just... too alien. which is funny, because pyjamas desktop shows what can be done: web browser engines can literally be turned into cross-platform GUI engines. l. -- http://mail.python.org/mailman/listinfo/python-list
pythonwebkit-gtk, pythonwebkit-dfb
in preparation for a 0.8 release of pyjamas, a bit of work has been done on pythonwebkit (http://www.gnu.org/software/pythonwebkit) that makes it easier to compile and install. pythonwebkit provides full and complete (see caveats below!) bindings to web browser functionality... in python. what you would normally expect to be able to do in javascript "in-browser", you can do EXACTLY the same thing, in a "declarative" programming style, in python: import gtk import pywebkitgtk url = "http://www.gnu.org/software/pythonwebkit"; wv = pywebkitgtk.WebView(1024,768, url=url) def _doc_loaded(*args): doc = wv.GetDomDocument() txt = doc.createTextNode("hello") doc.body.appendChild(txt) wv.SetDocumentLoadedCallback(_doc_loaded) gtk.main() yes, that's really python, doing a createTextNode and an appendChild, *not* javascript. not interpreted javascript, not interpreted python, *real* python, byte-coded and everything. throw in some AJAX, some browser event callbacks (onclick etc.) and some web browser timer callbacks and it all starts to get a bit weird, as two or maybe three disparate programming worlds that should never really have been brought together suddenly.. um... well, are brought together. the bit that's easier about installing pythonwebkit is that it is no longer necessary to download and patch up the http://code.google.com/p/pywebkitgtk project in order to use pythonwebkit. you can simply do "./autogen.sh" followed by the usual "make" and "make install". a new and absolute minimalist python module is created and installed which will get you a blank window - just like if you were firing up a python-GTK application or a python-QT4 application. anyway - just a bit of an informal not-really-announcement because, well, it's a side-dependency to the pyjamas project, even if it is a whopping 20mb one. those caveats btw are that a) you can't set CSS properties as if they were python object properties: you have to use the method "setProperty", duh, and b) there are *no* 2D or 3D SVG Canvas objects or functions available, yet, because it would take a good full-time 7 to 10 days to smack the codegenerator into shape and i'm waiting for someone to step forward and fund that work. am still servicing £20,000 in debt and still have to find a way to pay back a complete stranger who incredibly kindly paid £4,000 in owed rent so that we did not end up with a County Court Judgement against us. myself, my partner and our 25 month old daughter still got evicted, but that's another story. against this kind of background, perhaps i might be forgiven for not doing "freebie" free software development, i trust. l. -- http://mail.python.org/mailman/listinfo/python-list
pyjamas 0.4p1 release
This is a minor patch release of pyjamas 0.4p1, the Python-to-Javascript compiler and Python Web UI Widgets Toolkit. What is Pyjamas for? Pyjamas allows a developer to create U.I applications in python as if the Web Browser was a Desktop Widget Set toolkit platform (like pygtk2, pywxWidgets and pyqt4, only much simpler, and more powerful). No knowledge of javascript programming is required: the python-to-javascript compiler takes care of the conversion between python and javascript, and the U.I widget set takes care of all the browser and AJAX incompatibilities. Why don't I find that exciting? The significance of pyjamas takes a while to sink in. Or you're not a UI developer. Or you've never been asked to write an identical app that works on both the desktop and all major web browsers. If you're a python developer who has followed the history of web application development of the past decade, with much frustration and disappointment, is overwhelmed by Javascript, AJAX and the demands of the "Web 2.00o0ooo0 Revverlushun", then Pyjamas is something that you should consider investigating. Pyjamas 0.4p1 Bug-fixes (and accidental Features) Significant bugs fixed include HorizontalPanel's remove() function, SimplePanel's clear() function, and sprintf with multiple arguments ("%s %d" % ("hello", 2) will now work) Dialog Box now has modal functionality (thanks to jurgen kartnaller). HorizontalSplitPanel has been added, although both the horizontal and vertical panels operate correctly on Mozilla-based browsers, but Safari and IE need volunteers to work on them. Several more examples have also been added, including a spreadsheet-like GridEdit example; a Transparent SVG canvas clock widget (that actually tells the time); an "Information Hierarchy" example that could be used as the basis for an online cooperative spreadsheet editor; Erik Westra's "Showcase" source code which provides and shows the source of the 30 widgets being demo'd; and a few other minor examples. Discussion: http://groups.google.com/group/pyjamas-dev/ Bugs: http://code.google.com/p/pyjamas/issues/list Downloads: https://sourceforge.net/project/showfiles.php?group_id=239074 http://code.google.com/p/pyjamas/downloads/list Web site: http://pyjs.org (pyjamas javascript compiler and UI widget set) http://pyjd.org (sister project, pyjamas-desktop) -- http://mail.python.org/mailman/listinfo/python-list
report on building of python 2.5.2 under msys under wine on linux.
no, the above subject-line is not a joke: i really _have_ successfully built python2.5.2 by installing wine on linux, then msys under wine, and then mingw32 compiler - no, not the linux mingw32-cross-compiler, the _native_ mingw32 compiler that runs under msys, and then hacking things into submission until it worked. issue-report: http://bugs.python.org/issue4954 source code: http://github.com/lkcl/pythonwine/tree/python_2.5.2_wine related issue-report: http://bugs.python.org/issue3871 related issue-report: http://bugs.python.org/issue1597850 i'm going to _try_ to merge in #3871 but it's... the prospect of sitting waiting for configure to take THREE hours to complete, due to /bin/sh.exe instances taking TWO SECONDS _each_ to start up does not really fill me with deep joy. consequently i did a major hatchet-job on configure.in with repeated applications of "if test $win32build = no; then" ... cue several hundred lines of configure.in tests blatantly ignored "fi # $win32build=no! " and thus cut the configure time down from three hours to a mere 15 minutes. the only reason why this was possible at all was because PC/config.h already exists and has been pre-set-up with lots of lovely #defines. also, there is another significant difference between #3871 and #4954 - i chose to build in to libpython2.5.dll exactly as many modules as are in the proprietary win32 build. this turned out to be a good practical decision, due to /bin/sh.exe messing around and stopping python.exe from running! (under cmd.exe it's fine. i have to do a bit more investigation: my guess is that the msys "remounter" is getting in the way, somehow. compiling python to have a prefix of /python25 results in files being installed in /python25 which maps to c:/msys/python25/ but actually that doesn't get communicated correctly to the compiled python.exe it's all a bit odd - it still feels like things are being cross-compiled... but they're not... it's just that setup.py has paths that don't _quite_ match up with the msys environment... needs work, there. the regression testing is _great_ fun! some of the failures are really quite spectacular, but surprisingly there are less than anticipated. file "sharing violation" isn't a big surprise (under wine); the ctypes structure failures are going to be a bitch to hunt down; the test_str %f failure _was_ a big surpise; the builtin file \r\n <-> \n thing wasn't in the _least_ bit of a surprise :) overall, this has been... interesting. and the key thing is that thanks to #3871 and #4954 and #1597850, python will soon happily compile for win32 _without_ the dependence on _any_ proprietary software or operating systems. that's a pretty significant milestone. l. p.s. if anyone would like to try out this build, on a windows box, to see if it fares any better on the regression tests please say so and i will make the binaries available. -- http://mail.python.org/mailman/listinfo/python-list
Re: report on building of python 2.5.2 under msys under wine on linux.
> practical decision, due to /bin/sh.exe messing around and stopping > python.exe from running! (under cmd.exe it's fine. i have to do a > bit more investigation: http://bugs.python.org/issue4956 found it. -- http://mail.python.org/mailman/listinfo/python-list
libmsi.a import library from wine, and header files available (entirely free software), available for python-win32 builds under msys+wine
as part of building python2.5.2 under msys under wine on linux using mingw, i thought i'd try building _msi.pyd just for kicks. of course, that required having an msi.lib import library, and associated header files. so, purely as an experiment, i've documented the process by which it is possible to take wine 1.1.13 (current development release) source code, modify the header files for use with mingw, create a typelibrary (using dlltool) and then, surprise-surprise, _msi.pyd successfully builds. i say successfully builds: but then, running from _outside_ of a wineconsole cmd, doing this: /usr/local/bin/wine ./python.exe -c 'import _msi' succeeds. but if you do this: /usr/local/bin/wineconsole cmd c:/python2.5/bin/python.exde -c 'import _msi' you get an "access violation - no access to memory" blah blah to be honest, i don't care about that: this message is to let people know that it _is_ possible, and, if anyone is interested in e.g. adding -lmsi -lcabinet support to MinGW, here's where you can get the necessary crud: http://lkcl.net/msi.tgz if the wine team have any objections, if they believe this is a bad idea, please do say so :) l. p.s. if anyone would like to add a regression test to python called "test_msi.py" - or if they know of one that exists, i'd love to hear from you and try it out. outside of a wine cmd.exe of course :) -- http://mail.python.org/mailman/listinfo/python-list