Difference between del and remove?
Got a quick n00b question. What's the difference between del and remove? -- http://mail.python.org/mailman/listinfo/python-list
Re: Difference between del and remove?
Thanks for the clarification guys. :) On Dec 13, 7:05 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > Yansky <[EMAIL PROTECTED]> wrote: > > >Got a quick n00b question. What's the difference between del and > >remove? > > It would have been easier to answer if you had given a little context. > > "del" is a Python statement that removes a name from a namespace, an item > from a dictionary, or an item from a list. > > "remove" is a member function of the 'list' class that finds a specific > entry in the list and removes it. > > Example: > > >>> e = [9,8,7,6] ; del e[2] ; e > > [9, 8, 6] > > >>> e = [9,8,7,6] ; e.remove(2) ; e > > Traceback (most recent call last): > File "", line 1, in ? > ValueError: list.remove(x): x not in list > > >>> e = [9,8,7,6] ; e.remove(8) ; e > > [9, 7, 6] > > Note that "del e[2]" removed item number 2 (counting from 0). e.remove(8) > removed the item that had the value 8 from the list. e.remove(2) failed > because the number 2 was not in the list. > > Dictionaries do not have a "remove" method. You have to use the "del" > statement. > -- > Tim Roberts, [EMAIL PROTECTED] > Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Problems getting Python scripts to run on server
Hi, I'm having a lot of problems getting any Python scripts to run on my website. I have put them in the cgi-bin directory and chmodded both the directory and files to 755. But when I try to access the script, I get a 404 error: http://forboden.com/cgi-bin/wp.py I also tried running them from another directory and giving the directory its own .htaccess file containing: Options +ExecCGI AddHandler cgi-script .py but again, they still wouldn't run. The odd thing is, its not that they don't run per se, but that I get a 404 error. When I tried the scripts in the other folder (the non cgi- bin folder), before I added a .htaccess file, I tried the scripts and sure enough it displayed the file source code. But when I added the .htaccess file, I got a 404 file not found error. I emailed my hosting company and they said: "Python is currently installed on the server and is running without any issues. The URL you have provided is not showing any errors on the server. I would advise checking over your scripting to ensure that the issue isn't there." Anyone have any ideas as to what's going wrong? -- http://mail.python.org/mailman/listinfo/python-list
Problems installing Python on server
I asked my hosting company if they would upgrade Python on my server to the latest version. They responded with: "Sorry no. We tend to stick with what comes packaged with the unix distribution to ease maintenance issues. There is nothing stopping you from running your own version of python from within your own account. Download the source and compile it and install it into your own space. Adjust the fist line of your python scripts to reflect the location of YOUR python binary: #! /home/youraccount/yourlibs/python and you should be all set." The build instructions for Python are: To start building right away (on UNIX): type "./configure" in the current directory and when it finishes, type "make". This creates an executable "./python"; to install in usr/local, first do "su root" and then "make install". The problem is, I don't have root access to the server so I can't do the "make install". I have ubuntu on my computer, but from what I understand I can't compile it on that and upload it because the server runs Red Had and the ./configure would have made it incompatible right? So how can I build Python without root access? -- http://mail.python.org/mailman/listinfo/python-list
Online Debugging
I'm trying to debug a script on my server and it's taking forever using print to find the error. I've tried to use the debugging examples on this page http://webpython.codepoint.net/debugging but they don't seem to be working for me. Is there an easier/better way to debug online scripts? I was hoping there might be something similar to php where it gives some error info and the line code. Cheers. -- http://mail.python.org/mailman/listinfo/python-list
problems debugging python script on server
I'm having some problems debugging a python script on my server. I'm getting a "500 Internal Server Error". What the script does is take a link and then scrape a page and store some info from the page into a database. It seemed to be working fine until I changed one line of code from: shortenLink = "/forum-replies.cfm?t="+threadNum+"&p="+pageNum +"#r"+anchorNum to: shortenLink = "/forum-replies.cfm?t="+threadNum+"&p="+pageNum +"#r"+anchorNum if pageNum == '1': shortenLink = "/forum-replies.cfm?t="+threadNum+"#r"+anchorNum Here is the form page where the link is submitted: http://goodbyepolar.com/cgi-bin/avatar.py Here is the code from the script that processes the form: http://codedumper.com/avuno You can use this URL in the form page to generate the "500 Internal Server Error": http://forums.whirlpool.net.au/forum-replies-herring.cfm?r=16373017&tpr=1035665,1,2 As you can see from my codedump, I'm using import cgitb; cgitb.enable() to try to find the error, but with no success. I'm really at a loss as to why it's generating this error. Any help would be appreciated. Cheers. -- http://mail.python.org/mailman/listinfo/python-list
