Python in web development
Hello All, I have been using Python as a scripting language for my office tasks. Now I have been thinking of using (and learning as well) for web development. For my tasks, I need to perform some tasks and report on the web. Now I have no experience of web development with Python. So, I want to conform first whether Python is best for web development. Python is my personal choice for my automation works and I want to extend it for web development. REQUIREMENT: I need to develop a html form which would take user input and perform some operations (generate intermediate files) and report result on web. >> Some guys in my organization are using Perl for this purpose and thus I >> could get the setup for free.But I want to learn and use Python as >> substitute for Perl. (PHP could also be an option. I have worked on PHP once >> for handling the form data.) So my questions are:- 1. Can I use Python (I want to use personally :)) over PHP/Perl? 2. If Yes, I want to know the modules that I should learn for achieving my requirement. I searched internet and found Python provides CGI, Django etc. I don't much about Django/CGI, please suggest which module I should learn and use. Thanks Sarbjit -- http://mail.python.org/mailman/listinfo/python-list
Re: How to install development package on linux?
On Sunday, March 3, 2013 12:09:46 PM UTC+5:30, Sarbjit singh wrote: > On Sunday, March 3, 2013 11:53:50 AM UTC+5:30, Benjamin Kaplan wrote: > > > On Sat, Mar 2, 2013 at 10:14 PM, Sarbjit singh > > wrote: > > > > > > > > > > > > > > I searched on google and found these errors could be due to missing > > > python header files which would be available in development package. > > > > > > > > > > > > > > So I am struggling to make it work. > > > > > > > > > > > > > > > > > > A "development package" is meaningless when you aren't installing it > > > > > > from a package. Debian's binary packages don't include the header > > > > > > files, so they put them in a different package. Since you compiled > > > > > > from source, you already have the header files. Did you include the > > > > > > directory you installed Python into on your library and includes > > > > > > paths? > > > > Yes, I configured the makefile for mod_wsgi as without any error : > > > > ./configure --prefix=/opt/lampp/ --with-apxs=/opt/lampp/bin/apxs > --with-python=/opt/lampp/python/bin/python2.7 > --with-mutex-dir=/opt/lampp/var/run/wsgi Also my LD_LIBRARY_PATH does have path as : /opt/lammp/python/lib Just one more point, while initially I was trying to compiling the mod_wsgi, I was getting error for "libpython2.7.1.0.so Shared library error". I resolved it by creating a soft link to this file in my /usr/lib and /usr/lib64. At that point also my LD_LIBRARY_PATH was having path for python lib but was resolved with soft link only. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to install development package on linux?
On Sunday, March 3, 2013 11:53:50 AM UTC+5:30, Benjamin Kaplan wrote: > On Sat, Mar 2, 2013 at 10:14 PM, Sarbjit singh wrote: > > > > > > I searched on google and found these errors could be due to missing python > > header files which would be available in development package. > > > > > > So I am struggling to make it work. > > > > > > A "development package" is meaningless when you aren't installing it > > from a package. Debian's binary packages don't include the header > > files, so they put them in a different package. Since you compiled > > from source, you already have the header files. Did you include the > > directory you installed Python into on your library and includes > > paths? Yes, I configured the makefile for mod_wsgi as without any error : ./configure --prefix=/opt/lampp/ --with-apxs=/opt/lampp/bin/apxs --with-python=/opt/lampp/python/bin/python2.7 --with-mutex-dir=/opt/lampp/var/run/wsgi -- http://mail.python.org/mailman/listinfo/python-list
Re: How to install development package on linux?
On Sunday, March 3, 2013 1:22:50 AM UTC+5:30, Kwpolska wrote: > On Sat, Mar 2, 2013 at 7:00 PM, Sarbjit singh wrote: > > > On Saturday, March 2, 2013 2:15:08 PM UTC+5:30, Kwpolska wrote: > > >> On Sat, Mar 2, 2013 at 7:24 AM, Sarbjit singh > >> wrote: > > >> > > >> > Sorry for this basic question but I am having problem compiling mod_wsgi > >> > on Linux. As per mod_wsgi package site, user must have python > >> > development package installed on system. > > >> > > >> > > > >> > > >> > I had installed Python2.7 on my Linux system from source code, using the > >> > following configuration few months back :- > > >> > > >> > > > >> > > >> > ./configure –prefix= --enable-shared > > >> > > >> > Make –i install > > >> > > >> > > > >> > > >> > But I am not able to find how to install development package from source > >> > code. > > >> > > >> > > > >> > > >> > Can some one please conform if I can install the development package > >> > from the same source code (Downloaded from Python Website for Unix) and > >> > please share the configuration switch for the same. > > >> > > >> > > > >> > > >> > Thanks, > > >> > > >> > Sarbjit > > >> > > >> > -- > > >> > > >> > http://mail.python.org/mailman/listinfo/python-list > > >> > > >> > > >> > > >> Why do you use source tarballs? Your distro should provide nice > > >> > > >> binary packages for Python and mod_wsgi. And in case it doesn’t, your > > >> > > >> distro sucks and you should find a better one. > > >> > > >> > > >> > > >> The development things are usually installed by default by most > > >> > > >> things. Distributions offer them in -dev or -devel packages. > > >> > > >> > > >> > > >> -- > > >> > > >> Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16 > > >> > > >> stop html mail| always bottom-post > > >> > > >> http://asciiribbon.org| http://caliburn.nl/topposting.html > > > > > > I am using Red Hat 5, could you please give some pointers on how to install > > these packages? > > > -- > > > http://mail.python.org/mailman/listinfo/python-list > > > > Impossible, unless you: > > (a) build such packages yourself (Fedora .spec files may help you); or > > (b) upgrade to RHEL 6, which offers packages for python 2.6 and mod_wsgi; or > > (c) look for such packages on the Internet (you probably won’t find any). > > > > So, get back to compiling from source. Have you actually tried > > building those packages before asking? Because, according to the Arch > > Linux PKGBUILDs for python2 and mod_wsgi2, it doesn’t have any > > specific switches to enable anything “devel-related” (also, Arch Linux > > doesn’t bother with the dumb -dev(el) packages, which make no sense in > > real life). > > > > -- > > Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16 > > stop html mail| always bottom-post > > http://asciiribbon.org| http://caliburn.nl/topposting.html Its not possible for me to switch to Red Hat6 at the moment. Yes, I did tried compiling these from the source code and got some errors. I am using Xaamp for linux and following the below link for configuring python/mod_wsgi :- http://www.apachefriends.org/f/viewtopic.php?f=17&t=42975 When I initially tried to compile mod_wsgi, I was getting errors which got resolved by using development package fro Xammp for linux. (Solution found on google) Now I am getting the following compiling errors:- # mod_wsgi.c:14967: error: expected expression before ')' token mod_wsgi.c:14974: error: expected ';' before 'do' mod_wsgi.c:14979: error: expected ';' before '}' token mod_wsgi.c:14984: error: too many arguments to function 'wsgi_log_python_error' mod_wsgi.c:14989: error: expected expression before 'module' mod_wsgi.c: In function 'wsgi_allow_access': mod_wsgi.c:15003: error: 'PyObject' undeclared (first use
Re: How to install development package on linux?
On Saturday, March 2, 2013 2:15:08 PM UTC+5:30, Kwpolska wrote: > On Sat, Mar 2, 2013 at 7:24 AM, Sarbjit singh wrote: > > > Sorry for this basic question but I am having problem compiling mod_wsgi on > > Linux. As per mod_wsgi package site, user must have python development > > package installed on system. > > > > > > I had installed Python2.7 on my Linux system from source code, using the > > following configuration few months back :- > > > > > > ./configure –prefix= --enable-shared > > > Make –i install > > > > > > But I am not able to find how to install development package from source > > code. > > > > > > Can some one please conform if I can install the development package from > > the same source code (Downloaded from Python Website for Unix) and please > > share the configuration switch for the same. > > > > > > Thanks, > > > Sarbjit > > > -- > > > http://mail.python.org/mailman/listinfo/python-list > > > > Why do you use source tarballs? Your distro should provide nice > > binary packages for Python and mod_wsgi. And in case it doesn’t, your > > distro sucks and you should find a better one. > > > > The development things are usually installed by default by most > > things. Distributions offer them in -dev or -devel packages. > > > > -- > > Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16 > > stop html mail| always bottom-post > > http://asciiribbon.org| http://caliburn.nl/topposting.html I am using Red Hat 5, could you please give some pointers on how to install these packages? -- http://mail.python.org/mailman/listinfo/python-list
How to install development package on linux?
Sorry for this basic question but I am having problem compiling mod_wsgi on Linux. As per mod_wsgi package site, user must have python development package installed on system. I had installed Python2.7 on my Linux system from source code, using the following configuration few months back :- ./configure –prefix= --enable-shared Make –i install But I am not able to find how to install development package from source code. Can some one please conform if I can install the development package from the same source code (Downloaded from Python Website for Unix) and please share the configuration switch for the same. Thanks, Sarbjit -- http://mail.python.org/mailman/listinfo/python-list
How to print stdout before writing stdin using subprocess module in Python?
I am writing a script in which in the external system command may sometimes require user input. I am not able to handle that properly. I have tried using os.popen4 and subprocess module but could not achieve the desired behavior. Below mentioned example would show this problem using "cp" command. ("cp" command is used to show this problem, i am calling some different exe which may similarly prompt for user response in some scenarios). In this example there are two files present on disk and when user tries to copy file1 to file2, an conformer message comes up. proc = subprocess.Popen("cp -i a.txt b.txt", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,) stdout_val, stderr_val = proc.communicate() print stdout_val b.txt? proc.communicate("y") Now in this example if i read only stdout/stderr and prints it, later on if i try to write "y" or "n" based on user's input, i got an error that channel is closed. Can some one please help me on achieving this behavior in python such that i can print stdout first, then should take user input and write stdin later on. -- http://mail.python.org/mailman/listinfo/python-list
How to configure Tkinter Listbox to disable state keeping selected item highlighted
I am having a problem configuring a listbox widget such that the selection remains highlighted even while it is set (programmatically) to the DISABLED state. Below code shows the problem: from Tkinter import * master = Tk() listbox = Listbox(master) listbox.pack() listbox.insert(END, "Text1") listbox.insert(END, "Text2") listbox.insert(END, "Text3") listbox.selection_set(first=0, last=None) listbox.configure(exportselection=False) listbox.configure(state=DISABLED) Now when I change state to NORMAL, selected item is being highlighted. Is there a way I could disable widget (i.e. No response on mouse clicks) but keep the selected object remain highlighted? Intent: I want to utilise this widget on wizard App that I am creating. I would like this widget to indicate the current page / wizard number which the user selected. Is there any other widget I could use instead of it? (Labels possibly?) -- http://mail.python.org/mailman/listinfo/python-list