Error in running python -v on Mac ox 10.5.
Hi,
I run 'python -v' on Macos 10.5 but I get this error :
# can't create /System/Library/Frameworks/Python.framework/Versions/
2.5/lib/python2.5/encodings/utf_8.pyc
Can you please tell me how to fix it?
And why I am seeing a lot of 'install' message' when i run 'python -
v'? I don't think I see that many
install message on linux.
Here is the full message. Thanks for any help.
$ python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site.pyc matches /System/Library/Frameworks/Python.framework/
Versions/2.5/lib/python2.5/site.py
import site # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/site.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/os.pyc matches /System/Library/Frameworks/Python.framework/
Versions/2.5/lib/python2.5/os.py
import os # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/os.pyc
import posix # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/posixpath.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/posixpath.py
import posixpath # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/posixpath.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/stat.pyc matches /System/Library/Frameworks/Python.framework/
Versions/2.5/lib/python2.5/stat.py
import stat # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/stat.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/UserDict.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/UserDict.py
import UserDict # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/UserDict.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/copy_reg.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/copy_reg.py
import copy_reg # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/copy_reg.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/types.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/types.py
import types # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/types.pyc
import _types # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/warnings.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/warnings.py
import warnings # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/warnings.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/linecache.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/linecache.py
import linecache # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/linecache.pyc
import encodings # directory /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/encodings
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/encodings/__init__.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/encodings/__init__.py
import encodings # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/encodings/__init__.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/codecs.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/codecs.py
import codecs # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/codecs.pyc
import _codecs # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/encodings/aliases.pyc matches /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/encodings/aliases.py
import encodings.aliases # precompiled from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/encodings/aliases.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/encodings/utf_8.pyc has bad mtime
import encodings.utf_8 # from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/encodings/utf_8.py
# can't create /System/Library/Frameworks/Python.framework/Versions/
2.5/lib/python2.5/encodings/utf_8.pyc
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
dlopen("/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/lib-dynload/readline.so", 2);
import readline # dynamically loaded from /System/Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/lib-dynload/readline.s
Install Python 3.0 dmg to macos 10.5
Hi, If I install python 3.0 dmg, will it wipe out the existing python installation on macos 10.5 (i don't know how the original python was installed ( i think it is version 2.5). Thank you. -- http://mail.python.org/mailman/listinfo/python-list
How can I find the remainder when dividing 2 integers
I have a string array: colors = ["#ff", "#00FF00", "#FF"] colorIndex = 0; and I want to loop thru each element of colors for str in strings: print colors[colorIndex++ % colors.length] But i get an invalid syntax error when I execute the script: print colors[colorIndex++ % colors.length] ^ SyntaxError: invalid syntax -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I find the remainder when dividing 2 integers
okay, I try you suggestion, and re-write my code like this: colors = ["#ff", "#00FF00", "#FF"] colorIndex = 0 def getText(nodelist): for str in strings: print colors[colorIndex % colors.length] colorIndex += 1 but i get this error: print colors[colorIndex % colors.length] UnboundLocalError: local variable 'colorIndex' referenced before assignment -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I find the remainder when dividing 2 integers
Can you please tell me what is the meaning of UnboundLocalError: local variable 'colorIndex' referenced before assignment in general? -- http://mail.python.org/mailman/listinfo/python-list
UnboundLocalError: local variable 'colorIndex' referenced
Can you please tell me what is the meaning this error in general? UnboundLocalError: local variable 'colorIndex' referenced before assignment In my python script, I have a variable define and init to 0, like this colorIndex = 0 and in one of my functions, I increment it by 1 def myFunc colorIndex += 1 -- http://mail.python.org/mailman/listinfo/python-list
Question about strftime
Hi,
I have question about strftime. I am trying to print the current time
in this format:
date = strftime("%Y%m%d_%H%M%S", gmtime())
print date
I run the script at 2:18 pm, but I get this: 20070210_201837
Can you please tell me why I get '20'? instead of '14' (which is 2:00
pm)?
Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
How to call a function defined in another py file
Hi, I have a function called 'test' defined in A.py. How can I call that function test in my another file B.py? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to call a function defined in another py file
On Feb 19, 2:22 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> schrieb > > > I have a function called 'test' defined in A.py. > > How can I call that function test in my another file B.py? > > In B.py: > > import A > > A.test() > > HTH > Martin But Do I need to put A.py and B.py in the same directory? if not, where does python look for A.py ? And do I need to compile A.py before I can import it to B.py? -- http://mail.python.org/mailman/listinfo/python-list
Walk thru each subdirectory from a top directory
i am trying to use python to walk thru each subdirectory from a top directory. Here is my script: savedPagesDirectory = "/home/meryl/saved_pages/data" dir=open(savedPagesDirectory, 'r') for file in dir: if (isdir(file)): # get the full path of the file fileName = savedPagesDirectory + file + 'index.html' print fileName $ ./scripts/regressionTest.py Traceback (most recent call last): File "./scripts/regressionTest.py", line 12, in ? dir=open(savedPagesDirectory, 'r') IOError: [Errno 21] Is a directory But I get the above error: Can you please tell me what did I do wrong? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Need help in understanding a python code
This is the full source code: def A(w, v, i,j): if i == 0 or j == 0: return 0 if w[i-1] > j: return A(w, v, i-1, j) if w[i-1] <= j: return max(A(w,v, i-1, j), v[i-1] + A(w,v, i-1, j - w[i-1])) I am reading this blog http://20bits.com/articles/introduction-to-dynamic-programming/ On Sat, Nov 15, 2008 at 10:54 PM, Chris Rebert <[EMAIL PROTECTED]> wrote: > On Sat, Nov 15, 2008 at 8:41 PM, [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: >> Hi, >> >> I am trying to understand the following line: >> # a is an integer array >> >> max([(sum(a[j:i]), (j,i)) > > This code isn't valid. You have a [ with no closing ]. > > Cheers, > Chris > -- > Follow the path of the Iguana... > http://rebertia.com > >> >> Can you please tell me what that means, >> I think sum(a[j:i] means find the some from a[j] to a[i] >> But what is the meaning of the part (j,i)? >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > -- http://mail.python.org/mailman/listinfo/python-list
Use python to process XML file
Hi, Can you please tell me how Use python to process XML file? The example I find is build a DOM, but I just need to do it in SAX based, how can I do that? For example, I have a xml file like this: text text text text text text text For i want to process the node in the order they appears. If element name == 'a' do this else If element name == 'b' do this else If element name == 'c' do this -- http://mail.python.org/mailman/listinfo/python-list
