Re: webbrowser failing
"Thomas Thomas" <[EMAIL PROTECTED]> said: >Hi All, > >import webbrowser >url='http://www.cnn.com' >webbrowser.open(url) > >giving the error > >Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32 >Type "help", "copyright", "credits" or "license" for more information. ## working on region in file c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/python-1720WXU.py... >Traceback (most recent call last): > File "", line 1, in ? > File "c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/python-1720WXU.py", line 3, in ? >webbrowser.open(url) > File "C:\Python23\lib\webbrowser.py", line 43, in open >get().open(url, new, autoraise) > File "C:\Python23\lib\webbrowser.py", line 250, in open >os.startfile(url) >WindowsError: [Errno 2] The system cannot find the file specified: >'http://www.cnn.com' > >any help >Thoma Were you connected when you tried? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python.org, Website of Satan
"Luis M. Gonzalez" <[EMAIL PROTECTED]> said: >[EMAIL PROTECTED] wrote: >> python.org = 194.109.137.226 >> >> 194 + 109 + 137 + 226 = 666 >> >> What is this website with such a demonic name and IP address? What >> evils are the programmers who use this language up to? >You dared to unveil our secret. >Now we'll have to kill you... > But is 194.109.137.226 the only one? What other sites are in league with the python? -- http://mail.python.org/mailman/listinfo/python-list
Re: variable declaration
"EP" <[EMAIL PROTECTED]> said: >> Original Message >> From: [EMAIL PROTECTED] (Alexander Zatvornitskiy) > >> >> Hello All! >> >> I'am novice in python, and I find one very bad thing (from my point of >> view) in >> language. There is no keyword or syntax to declare variable, like 'var' >> in >> Pascal, or special syntax in C. It can cause very ugly errors,like >> this: >> >> epsilon=0 >> S=0 >> while epsilon<10: >> S=S+epsilon >> epselon=epsilon+1 >> print S >> >> It will print zero, and it is not easy to find such a bug! > > >Hmmm. I am surely an expert in writing buggy code, but I can not say I make >this error in Python. Why is that? > >I'm not sure, but a couple things that may help me miss making this mistake in >practice may be (somewhat informal in my case) unit testing - I test for >correct results for at least a few cases. > >It may also help that with Python I can code at a somewhat higher conceptual >level, or maybe it is just the syntax that helps avoid these problems: > for epsilon in range (0,10): > S=S+epsilon > for epsilon in range (0,10): > S=S+epselon > >Traceback (most recent call last): > File "", line 2, in ? >S=S+epselon >NameError: name 'epselon' is not defined > > >It may seem like jumping off a cliff, but the improvement in readability (the >variable declarations being visual clutter) makes it much easier for me to see >my code, and any typos in it. > >It seems it would be simple enough to have one's code, or another script, >automatically print out a sorted list of the variables - which would make the >error you note obvious. But I haven't needed this, yet at least. > >You might like Python and find the lack of variable declaration checking not a >problem. It's worth a shot. > > class MyVars(object): __slots__ = ['epsilon', 'thud', 'foo'] mv = MyVars() mv.epselon = 42 Traceback (most recent call last) /home/dw/KirbyBase-1.7/ AttributeError: 'MyVars' object has no attribute 'epselon' mv.epsilon = 42 -- http://mail.python.org/mailman/listinfo/python-list
Re: IPython colors in windows
"Ashot" <[EMAIL PROTECTED]> said: >On 3 Feb 2005 19:18:33 -0800, James <[EMAIL PROTECTED]> wrote: > >> >> Ashot wrote: >>> I am using IPython in windows and the LightBG setting doesn't >> correctly >>> because the background of the text is black even if the console >> background >>> is white. Anyone know whats going on? Thanks. >>> >>> -- >>> == >>> Ashot Petrosian >>> University of Texas at Austin, Computer Sciences >>> (views expressed are solely my own) >>> == >> >> Did you try installing readline for windows? >> http://newcenturycomputers.net/projects/readline.html >> > >yea I've installed that and ctypes. The color and tab completion work, >its just that colored get displayed with black background, it almost works >so its very frustrating.. > Did you try the following (from the manual)?: Input/Output prompts and exception tracebacks You can test whether the colored prompts and tracebacks work on your system interactively by typing '%colors Linux' at the prompt (use '%colors LightBG' if your terminal has a light background). If the input prompt shows garbage like: [0;32mIn [[1;32m1[0;32m]: [0;00m instead of (in color) something like: In [1]: this means that your terminal doesn't properly handle color escape sequences. You can go to a 'no color' mode by typing '%colors NoColor'. You can try using a different terminal emulator program. To permanently set your color preferences, edit the file $HOME/.ipython/ipythonrc and set the colors option to the desired value. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python executable
"presentt" <[EMAIL PROTECTED]> said: >Hello, > >I'm running Ubuntu Linux 5.04. > >I just started teaching myself Python today, and have been reading a >few things to get started. I came across something in one (namely >http://docs.python.org/tut/node4.html#SECTION00422) >that confused me a little. > >It says: > > > >On BSD'ish Unix systems, Python scripts can be made directly >executable, like shell scripts, by putting the line > >#! /usr/bin/env python > >(assuming that the interpreter is on the user's PATH) at the beginning >of the script and giving the file an executable mode. The "#!" must be >the first two characters of the file. On some platforms, this first >line must end with a Unix-style line ending ("\n"), not a Mac OS ("\r") >or Windows ("\r\n") line ending. Note that the hash, or pound, >character, "#", is used to start a comment in Python. > >The script can be given a executable mode, or permission, using the >chmod command: > >$ chmod +x myscript.py > >--- > >So I created a file named helloworld.py, and put in it: > >#! /usr/bin/env python >print "Hello, world!" > >and then used >$ chmod +x helloworld.py >to set the permissions. Finally, I went to my terminal and typed >$ helloworld.py >but I was given the bash: helloworld.py: command not found error. > >Can someone tell me >(1)Am I right in saying that something is directly executable if I can >enter the filename in the command line and it runs? >(2)Am I setting up the script to be directly executable correctly? >and (3)Am I trying to run the directly executable script correctly? > >Thanks a lot. I hope this post isn't too hard to follow; I know I'm >asking a lot. > >~~Ted Present > [3] cd to the directory that contains helloworld.py, then ./helloworld.py (When you enter helloworld.py as a command, the shell searches the PATH for helloworld.py and if it is not found, it complains. If you tell it that it's in the current directory, it will get it without searching.) -- http://mail.python.org/mailman/listinfo/python-list
Re: A beginner's problem...
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> said: >In <[EMAIL PROTECTED]>, Amir Dekel wrote: > >> When I import a module I have wrote, and then I find bugs, it seems that >> I can't import it again after a fix it. It always shows the same >> problem. I try del module but it doesn't work. >> (I use Python 2.4 with the ActivePython pack (PythonWin IDE) >> >> Solution anyone? > >Yes -> help(reload) > >Ciao, > Marc 'BlackJack' Rintsch First, save the file using the check option (Ctl+Shift+C, iirc); Second, Fix any errors (attend to Status Bar); Third, press Reload button in Toolbar (or type command from File Menu). Four, assure that Status Bar indicates reload was successful. If still doesn't load correctly, quit PythonWin and start it again. -- http://mail.python.org/mailman/listinfo/python-list
Re: begging for a tree implementation
Micah wrote: > I'm looking for a simple tree implementation: 0-n children, 1 root. > All the nice methods would be appreciated (getLeaves, isLeaf, isRoot, > depthfirst, breadthfirst,...) That's really all I need. I could code > one up, but it would take time to debug, and i'm really short on time > right now. > > Thanks! > Micah > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/136529 -- http://mail.python.org/mailman/listinfo/python-list