python regex character group matches
hello python-list! the other day, i was trying to match unicode character sequences that looked like this: \\uAD0X... my issue, is that the pattern i used was returning: [ '\\uAD0X', '\\u1BF3', ... ] when i expected: [ '\\uAD0X\\u1BF3', ] the code looks something like this: pat = re.compile((\\\u[0-9A-F]{4})+, re.UNICODE|re.LOCALE) #print pat.findall(txt_line) results = pat.finditer(txt_line) i ran the pattern through a couple of my colleagues and they were all in agreement that my pattern should have matched correctly. is this a simple case of a messed up regex or am i not using the regex api correctly? cheers, ct -- http://mail.python.org/mailman/listinfo/python-list
python regex character group matches...group...gotcha
My apologies to the respondents - I failed to screen my test cases before kicking them out to the global python-list. but yes, the 'X' character in my test case was a mistake on my part. I'll give group() a shot. ct -- http://mail.python.org/mailman/listinfo/python-list
Re: Help: Python2.3 Python2.4 on RHEL4 x86_64
Ah, I see. The reason is pretty simple: Makefile.pre.in has LIBDIR= $(exec_prefix)/lib so it seems that LIBDIR isn't configurable. So you would agree that this is a bug? I'll post on Python-Dev for further advice. I'd like to fix this for the x86_64 community. You will have to debug this (can't do right now); see Modules/getpath.c, and the definition of PYTHONPATH. It seems this isn't really supported. I'll ask on Python-Dev for more details on how to fix this. Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: Help: Python2.3 Python2.4 on RHEL4 x86_64
I personally think this is a bug in AMD64-Linux. Libraries should be stored in /usr/lib, binaries in /usr/bin, etc. If they need simultaneous installation of 32-bit binaries for compatibility, they should store them in architecture-specific directories. I disagree. From what I see, the error, as far as python is considered, is not being able to specify the location where libs are put, despite the fact that the --LIBDIR= option is listed. It just happens to manifest itself in AMD64/EM64T Linux, specifically RH linux where 64bit libs are put in /usr/lib64 and 32bit libs in /usr/lib. The x86_64 community has been using Python for a while, and apparently has solved this problem already. You should try to find out how they did it. Where might I go to look on how to get this working? Respectfully, Christopher Taylor P.S. I posted on python-dev and I haven't seen my post show up yet, nor any responces is that list moderated? -- http://mail.python.org/mailman/listinfo/python-list
Re: Help: Python2.3 Python2.4 on RHEL4 x86_64
Ok. One solution might be to remove the libdir option, then. Python attempts to be movable, i.e. the libraries are found relative to the executable (via dirname(sys.executable)+../lib/...). If libdir is supported, this approach must be given up - or libdir must be given up. Well, honestly, seeings how LIBDIR doesn't do anything ... I can see the argument for removing it. However, I would like to propose a more flexible solution: Perhaps a ./configure parameter called LIBLOC or something like that so that LIBDIR = $(EXEC_PREFIX)/$(LIBLOC). Of course, LIBLOC should default to lib. This way the flexibility you mentioned above can be maintained and the 64bit community (which will eventually be the entire community) can move forward with minimal hassle. The Linux distributions already provide Python binaries (I believe Redhat does, too). You could study what they do to achieve that. Yes, this is true ... but they do not package the most up-to-date version .. which I need. Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Help: Python2.3 Python2.4 on RHEL4 x86_64
Does anyone have any comments on my proposed solution? However, I would like to propose a more flexible solution: Perhaps a ./configure parameter called LIBLOC or something like that so that LIBDIR = $(EXEC_PREFIX)/$(LIBLOC). Of course, LIBLOC should default to lib. This way the flexibility you mentioned above can be maintained and the 64bit community (which will eventually be the entire community) can move forward with minimal hassle. Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: Help: Python2.3 Python2.4 on RHEL4 x86_64
PYTHONPATH was the problem. I had /usr/lib64/python2.3 included and that's why it was breaking. I took it out and it works fine now. Unfortunately, it still puts the lib files in /usr/lib instead of /usr/lib64. I'm assuming all I need to do is set libdir accordingly and the files will get put in /usr/lib64. How do I then build the library files for 32bits? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: Help: Python2.3 Python2.4 on RHEL4 x86_64
Ok, so if I need to build the 32bit binaries, I just need to make sure I pass the right argument through to the compiler then? (I'm trying to build 32 bit and 64 bit binaries on the same system, but I'll wait untill I get just the 64bit stuff built first before I tackle that) Also, I've fooled around with passing --libdir=/usr/lib64 to the configure script and for whatever reason, the Makefile isn't correctly written. It always ends up copying the lib files to /usr/lib. So I thought I'd manually edit the Makefile by editing the makefile on lines 83 and 87 so they are now: 83: LIBDIR= $(exec_prefix)/lib64 87: SCRIPTDIR= $(prefix)/lib64 then: make clean make make test make altinstall cd .. python2.4 I get the following error message: Could not find platform independent libraries prefix Could not find platform dependent libraries exec_prefix Consider setting $PYTHONHOME to prefix[:exec_prefix] 'import site' failed; use -v for traceback so then I edited /etc/profile and added export PYTHONHOME=/usr then restarted and I got ride of the Could not find platform in/dependent libraries errors but I still get the 'import site' failed error. I did a python2.4 -v and below is the output: # installing zipimport hook import zipimport # builtin # installed zipimport hook 'import site' failed; traceback: ImportError: No module named site *** Now I'm lost *** Just for sanity sakes I undid the changes to lines 83 87 of the make file, did a make clean, make, make test, make altinstall, python2.4 followed by some goofing around and everything works fine. So I'm guessing my manual edits of the makefile didn't go well. Any idea what else I need to change? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: Install from source on a x86_64 machine
The README should provide sufficient information, although if you want to install Python into /usr rather than /usr/local (as I believe is the default), you need to run configure as follows: ./configure --prefix=/usr Yeah, I saw that in the readme. In fact, it's /usr/bin/python, /usr/bin/python2.3, /usr/lib64/python2.3 and /usr/lib/python, since Red Hat hasn't decided to capitalise the name of the software. ;-) ok you got me, type-o The configured Makefile together with the various other tools should work out where to put the libraries. I'm a newcomer to x86-64, although I've had some relatively recent experience with sparc64, and whilst I'm not really familiar with the way the various tools choose the install directory of libraries, I've noticed that sometimes 64-bit libraries end up in lib rather than lib64. Meanwhile, I notice that the Red Hat libraries do adhere correctly to the expectation that 32-bit libraries are found under /usr/lib/python2.3 and 64-bit libraries are found under /usr/lib64/python2.3. Perhaps you should configure and make Python, then run the install process in pretend mode: make -n altinstall You'll get a huge amount of output, but this should at least tell you what the installation process is thinking of doing, and it won't be overwriting anything important while it does so. ok, so where does that leave me. I'm not even sure which files *should* be put in /lib64 vs lib. I guess what I'm expecting is a congifure option to specify where architecture dependent files should be put. Has anyone else mentioned this before? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: Install from source on a x86_64 machine
Generally, the install process should respect the prefix (ie. /usr in your case, /usr/local in the default case) and then choose the appropriate library directories below that (ie. /usr/lib, /usr/lib64 in your case), but I can't find anything obvious in the README about specifying architecture-dependent install directories. Well that's pretty much what's happening ... either the 64bit libs aren't being put in /usr/lib64 ... they're all being put in /usr/lib or they were never compiled up in 64bit mode. The only think I can think of is that the configure script doesn't check the mode the OS is running in and take appropriate steps, ie.e compile the libs in both 32 and 64 bit mode and place them accordingly. I know this is a problem because when I try and compile up mod_python it's telling I'm getting the following error when it tries to link libpython2.4.a : /usr/bin/ld: /usr/lib/python2.4/config/libpython2.4.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/python2.4/config/libpython2.4.a: could not read symbols: Bad value Which basically means to me that for whatever reason, when python compiled up, the ./configure script didn't see that the os was running in 64bit mode and compile the libraries in PIC mode, something I think that is required for libraries on a 64bit OS. Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Compile for 64bit RHEL
Has anyone been able to get python 2.4 to compile properly for x86_64 RHEL? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Python RPM package arch compatability
Hello all, A quick question if I may. I'm running RHEL 4 on a x86_64 and I'm curious if any of the packages at http://www.python.org/download/releases/2.4/rpms/ would suite my setup. If they don't can I simply build from source and not overwrite /usr/bin/Python (for the same reasons as listed at the above mentioned webpage)? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: Python RPM package arch compatability
So just build it from source and use make altinstall instead? That simple huh? Will I need to do anything else to make sure things are put in their correct place? Respectfully, Christopher Taylor On 10/18/06, Fredrik Lundh [EMAIL PROTECTED] wrote: Christopher Taylor wrote: A quick question if I may. I'm running RHEL 4 on a x86_64 and I'm curious if any of the packages at http://www.python.org/download/releases/2.4/rpms/ would suite my setup. If they don't can I simply build from source and not overwrite /usr/bin/Python (for the same reasons as listed at the above mentioned webpage)? if you use make altinstall instead of make install, the installation process will only install a pythonX.Y binary (e.g. python2.5). /F -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Install from source on a x86_64 machine
Hello all, Being relatively new to linux I'm a little confused about what options I need to use to build python from source. Currently, I have python installed as part of the inital RHEL4 load located at /usr/bin/Python and /usr/bin/Python2.3 . Some of the files are located in /usr/lib64/Python2.3 and in /usr/lib/Python2.3 . Please let me know if you need dir lsitings. I'm trying to compile from source and plan on using the --enable-unicode=ucs4 option for the configure script due to some RHEL messing around with Tcl/Tk. *** How do I get make altinstall to put the appropriate files in /usr/lib64/Python2.4 and /usr/lib/Python2.4 respectively ? *** Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
Help: Python2.3 Python2.4 on RHEL4 x86_64
RHEL comes with Python2.3 installed. A program I need to install requires Python2.4 So I got Python2.4 from source and compiled it up. I configured it with --prefix=/usr --exec-prefix=/usr and --enable-unicode=ucs4 . I then make'd it and then make altinstall so that it didn't overwrite the /usr/bin/Python link to /usr/bin/Python2.3 . Well, for some reason, the arch dependent files did NOT get placed properly in /usr/lib64/Python2.4, they instead went to /usr/lib/Python2.4. Also, when I tried to load pysqlite: $ Python2.4 from pysqlite2 import test I get the following traceback: Traceback (most recent call last): File setup.py, line 24, in ? import glob, os, re, sys File /usr/lib64/python2.3/glob.py, line 4, in ? import fnmatch File /usr/lib64/python2.3/fnmatch.py, line 13, in ? import re File /usr/lib64/python2.3/re.py, line 5, in ? from sre import * File /usr/lib64/python2.3/sre.py, line 97, in ? import sre_compile File /usr/lib64/python2.3/sre_compile.py, line 17, in ? assert _sre.MAGIC == MAGIC, SRE module mismatch AssertionError: SRE module mismatch This basically means to me that Python2.4 is loading gloab.py from /usr/lib64/Python2.3 insead of /usr/lib/Python2.4 (even thought I wanted to install the related files in /usr/lib64/Python2.4) Can someome please help! Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list
?Incorrect Configure script?
I'm not sure if this is a problem with python or not. I'm trying to compile up mod_python to point to /usr/bin/python2.4 (RH has /usr/bin/python2.3 already installed to I don't want to mess with /usr/bin/python). When it gets to linking in /usr/lib/python2.4/config/libpython2.4.a I get the following error: /usr/bin/ld: /usr/lib/python2.4/config/libpython2.4.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/python2.4/config/libpython2.4.a: could not read symbols: Bad value I did some poking around and according to Gentoo's website (http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1chap=3) it appears that this is due to the fact that libpython2.4.a was not intially built with -fPIC, which it seems is required for AMD64 (so I'm assuming it's also required for my intel x86_64). Is this a bug in the configure script for python or did I just not set something correctly? Respectfully, Christopher Taylor -- http://mail.python.org/mailman/listinfo/python-list