Re: [Tutor] using python to write web page
Or maybe, you're lokking something like this: http://wiki.python.org/moin/PythonEditors On Wed, June 15, 2011 13:42, Michael bridges wrote: i would like to use python to write a web page like writing an html file that is displayed in a browser without having to run a server. found a few options, but need to have server running. https://skulpt.googlecode.com/hg/skulpt gives 404 error ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] using python to write web page
cherrypy is what you are looking for check this site: http://www.chandia.net:8080/ you cn download the code from here, so you can use it as you want: NMT-2.6-20110529.tar_.gz On Wed, June 15, 2011 13:42, Michael bridges wrote: i would like to use python to write a web page like writing an html file that is displayed in a browser without having to run a server. found a few options, but need to have server running. https://skulpt.googlecode.com/hg/skulpt gives 404 error ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Help to explain commenting
Hello everybody, I could finally complete succesfully the code I was working with. As I'm quite new to python, many of the things I have in my code are copied from different sources, and I do not undertand all of them, well, I have to deliver this code for a project, and in the best documented way that I could, I already commented all that I know, and I suppouse wrongly in some parts. So the request is, if you can take a look at the code, comment the parts that are not yet commented, correct the errors, and propouse some improvement in the parts you think diserves it. I attach the code in a tgz file, if the attached can not be seen then this link: http://www.chandia.net/compart/NMT-2.4-20110415.tar.gz Thanks in advance to all of you and to the people that already helped me. ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! NMT-2.4-20110415.tar.gz Description: GNU Zip compressed data ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Converting files
I don't know how to do it, but I'm 99% sure I have seen a something related in cherrypy pages, try googling cherrypy pdf generation or something similiar Good luck! El Mar, 12 de Abril de 2011, 10:02, sunil tech escribió: thank you for all your valuable suggestions... but i want it to be converted using python code .. On Tue, Apr 12, 2011 at 2:38 AM, Evans Anyokwu onyx...@gmail.com wrote: I use Openoffice and it has an option to export your files to .pdf and lots of other file formats. It's a free download - and has all the usual Office applications... Search for 'OpenOffice' online. On Mon, Apr 11, 2011 at 9:48 PM, Alan Gauld alan.ga...@btinternet.com wrote: sunil tech sunil.tech...@gmail.com wrote is there any way to convert any file (eg: document files image files) to .pdf? if so, kindly share... Install a PDF print driver and then print the file to that printer. Set it to save as a file. Then if its printable you can get it as a PDF. You can do the same with postscript(and postscript drivers come with most OS). Then send the postscript file to Adobe's web site to get them to generate the PDF from postscript. (You can also download free convertors) Finally, and because this is a Python list, you could use a Python library and generate the file yourself - but while thats ok for your own data its a lot harder for many file types! HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Converting files
this is the list for cherrypy cherrypy-users cherrypy-us...@googlegroups.com El Mar, 12 de Abril de 2011, 10:02, sunil tech escribió: thank you for all your valuable suggestions... but i want it to be converted using python code .. On Tue, Apr 12, 2011 at 2:38 AM, Evans Anyokwu onyx...@gmail.com wrote: I use Openoffice and it has an option to export your files to .pdf and lots of other file formats. It's a free download - and has all the usual Office applications... Search for 'OpenOffice' online. On Mon, Apr 11, 2011 at 9:48 PM, Alan Gauld alan.ga...@btinternet.com wrote: sunil tech sunil.tech...@gmail.com wrote is there any way to convert any file (eg: document files image files) to .pdf? if so, kindly share... Install a PDF print driver and then print the file to that printer. Set it to save as a file. Then if its printable you can get it as a PDF. You can do the same with postscript(and postscript drivers come with most OS). Then send the postscript file to Adobe's web site to get them to generate the PDF from postscript. (You can also download free convertors) Finally, and because this is a Python list, you could use a Python library and generate the file yourself - but while thats ok for your own data its a lot harder for many file types! HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Cherrypy and Iframes (or how to insert a file in a, page)
Thanks a lot Alan, I'm a complete newbe in cherrypy, actually this is my first cherrypy, so I had to go arround many tries to reach the goal, but your help was valuable and finally this is the config that gave me success: class helloworld(object): indexpage = indexpage() _cp_config = { 'tools.staticdir.on': True, 'tools.staticdir.root': '/path/to/root/folder', 'tools.staticdir.dir': '', } On Sun, April 10, 2011 01:04, Alan Harris-Reid wrote: Andreas... NotFound: (404, The path '/file.txt' was not found.) This error message often occurs because file.txt is a static file and you have not told CherryPy where to look for static files. From the look of the error I am guessing that file.txt is in your root directory, in which case you need the following in your configuration file. [/] tools.staticdir.root = '/path/to/root/folder' # no trailing backslash tools.staticdir.on = True tools.staticdir.dir =# necessary to serve static files in home folder Hope this helps. Alan Harris-Reid ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Cherrypy and Wysiwyg editor
I have put a textarea at a web generated by cherrypy, but I would like to add some user editing tool like HtmlArea, I've been sufing arround but I haven't found clear information. I would appreciate your help! ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Cherrypy HtmlArea
I have put a textarea at a web generated by cherrypy, but I would like to add some user editing tool like HtmlArea, I've been sufing arround but I haven't found clear information. I would appreciate your help! ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Cherrypy and Iframes (or how to insert a file in a page)
the codes return iframe src=\file.txt\ width=\100%\ height=\500\ scrolling=\auto\ frameborder=\2\/iframe file.txt is genereated by a previous python script and I need to display it at the web generated by cherrypy, but it gives me this error: Traceback (most recent call last): File /usr/lib/pymodules/python2.6/cherrypy/_cprequest.py, line 606, in respond cherrypy.response.body = self.handler() File /usr/lib/pymodules/python2.6/cherrypy/_cperror.py, line 227, in __call__ raise self NotFound: (404, The path '/file.txt' was not found.) I tryed changing the path with no success, so I guess is something different Maybe there is another way to do this ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] GUI IDLE for UBUNTU 10
Actually the default text editor in Ubuntu, gedit has a plugin named Python console, that you can activate at edit preferences menu, then at the menu view inferior subwindow (F9) you can activate it, maybe the menu names are not exact, because I'm translating from catalan. Good luck! On Wed, April 6, 2011 11:34, Ratna Banjara wrote: As i know python comes as default in ubuntu and can be accessed from terminal. But i found difficulty to write programs in editor and run from terminal. I need GUI Before this i used to run in windows with python IDLE which makes easy to write python codes and run using Run command or pressing F5. Now i want to ask if there is python GUI IDLE equivalent in Ubuntu. Please help. -- Regards, Ratna P Banjara ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] GUI IDLE for UBUNTU 10
Sorry, the command is Crtl+F9, not only F9 On Wed, April 6, 2011 12:43, Andrés Chandía wrote: Actually the default text editor in Ubuntu, gedit has a plugin named Python console, that you can activate at edit preferences menu, then at the menu view inferior subwindow (F9) you can activate it, maybe the menu names are not exact, because I'm translating from catalan. Good luck! On Wed, April 6, 2011 11:34, Ratna Banjara wrote: As i know python comes as default in ubuntu and can be accessed from terminal. But i found difficulty to write programs in editor and run from terminal. I need GUI Before this i used to run in windows with python IDLE which makes easy to write python codes and run using Run command or pressing F5. Now i want to ask if there is python GUI IDLE equivalent in Ubuntu. Please help. -- Regards, Ratna P Banjara ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Regex question
I continue working with RegExp, but I have reached a point for wich I can't find documentation, maybe there is no possible way to do it, any way I throw the question: This is my code: contents = re.sub(r'Á', A, contents) contents = re.sub(r'á', a, contents) contents = re.sub(r'É', E, contents) contents = re.sub(r'é', e, contents) contents = re.sub(r'Í', I, contents) contents = re.sub(r'í', i, contents) contents = re.sub(r'Ó', O, contents) contents = re.sub(r'ó', o, contents) contents = re.sub(r'Ú', U, contents) contents = re.sub(r'ú', u, contents) It is clear that I need to convert any accented vowel into the same not accented vowel, The qestion is : is there a way to say that whenever you find an accented character this one has to change into a non accented character, but not every character, it must be only this vowels and accented this way, because at the language I am working with, there are letters like ü, and ñ that should remain the same. thanks you all. ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Regex question
Thanks Kushal and Steve. I think it works,a I say I think because at the results I got a strange character instead of the letter that should appear this is my regexp: contents = re.sub(r'(u|span style=text-decoration: underline;)(l|L|n|N|t|T)(/span|/u)', '\2\'' ,contents) this is my input file content: ul/uomo un/uomo ut/uomo uL/uomo uN/uomo uT/uomo span style=text-decoration: underline;n/spanomo ut/uomo this is my output file content 'omo 'omo 'omo 'omo 'omo 'omo 'omo 'omo at to head of the file I got: #!/usr/bin/env python # -*- coding: utf-8 -*- I tried changing the coding to iso-8859-15, but nothing, for sure you know the reason for this, can you share it with this poor newbee Thanks a lot!! On Wed, March 30, 2011 09:46, Kushal Kumaran wrote: 2011/3/30 Andrés ChandÃa and...@chandia.net: I'm new to this list, so hello everybody!. Hello Andrés The stuff: I'm working with regexps and this is my line: contents = re.sub(ul\/u, le ,contents) in perl there is a way to reference previous registers, i.e. $text =~ s/u(l|L|n|N)\/u/$1e/g; So I'm looking for the way to do it in python, obviously this does not works: contents = re.sub(u(l|L|n|N)\/u, $1e, contents) You will use \1 for the backreference. The documentation of the re module (http://docs.python.org/library/re.html#re.sub) has an example. Also note the use of raw strings (r'...') to avoid having to escape the backslash with another backslash. ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Regex question
Thanks Steve, your are, from now on, my guru this is the final version, the good one! contents = re.sub(r'(u|span style=text-decoration: underline;)(l|L|n|N|t|T)(/span|/u)', r\2' ,contents) On Wed, March 30, 2011 17:27, Steve Willoughby wrote: On 30-Mar-11 08:21, Andrés Chandía wrote: Thanks Kushal and Steve. I think it works,a I say I think because at the results I got a strange character instead of the letter that should appear this is my regexp: contents = re.sub(r'(u|span style=text-decoration: underline;)(l|L|n|N|t|T)(/span|/u)', '\2\'' ,contents) Remember that \2 in a string means the ASCII character with the code 002. You need to escape this with an extra backslash: '\\2\'' Although it would be more convenient to switch to double quotes to make the inclusion of the literal single quote easier: \\2' How does that work? As the string is being built, the \\ is interpreted as a literal backslash, so the actual characters in the string's value end up being: \2' THAT is what is then passed into the sub() function, where \2 means to replace the second match. This can be yet simpler by using raw strings: r\2' Since in raw strings, backslashes do almost nothing special at all, so you don't need to double them. I should have thought of that when sending my original answer to your question. Sorry I overlooked it. --steve ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] (no subject)
I'm new to this list, so hello everybody!. The stuff: I'm working with regexps and this is my line: contents = re.sub(ul\/u, le ,contents) in perl there is a way to reference previous registers, i.e. $text =~ s/u(l|L|n|N)\/u/$1e/g; So I'm looking for the way to do it in python, obviously this does not works: contents = re.sub(u(l|L|n|N)\/u, $1e, contents) Thanks ___ andrés chandía P No imprima innecesariamente. ¡Cuide el medio ambiente! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor