RE: Build error Python 2.4.1 - stat problem?
Hello, I found the solution of my problems. The configure script decided to switch on large file support, but the #defines set in pyconfig.h caused an inconsistency between the stat function calls (32 bit versions) and the stat structures used (64 bit versions). After I switched off the large file support manually in pyconfig.h, all works fine. Maybe someone could change the configure script so that it tests whether the large files support really works (create a file of a few bytes and test its size)? - Servatius Servatius Brandt Phone: +49 89 636-41504 Fujitsu Siemens ComputersFax: +49 89 636-48716 EP SW AD C++ Email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Build error Python 2.4.1 - stat problem?
Brandt, Servatius wrote: > The stat values do not make any sense. It seems that the value used for > the mode is really the numbers of links (I created the two empty > /usr/local... directories to prevent the os.error exception): That sort of suggests that the definition of the stat struct is not what your build expects. If you used the configure script to generate the makefile, you should check whether any #define's modify the definition of this struct (usually in /usr/include/sys/stat.h), assuming configure found your system's stat.h, and see whether any such defines are set in your ./configure'd pyconfig.h. You may have to dig deeper still. - Andrew I MacIntyre "These thoughts are mine alone..." E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370 [EMAIL PROTECTED] (alt) |Belconnen ACT 2616 Web:http://www.andymac.org/ |Australia -- http://mail.python.org/mailman/listinfo/python-list
RE: Build error Python 2.4.1 - stat problem?
Donn Cave wrote: >In article <[EMAIL PROTECTED]>, > <[EMAIL PROTECTED]> wrote: >... >> I used the python executable from the build directory to run the >> following program: >> >> import os >> >> def main(): >> if not (os.path.exists("/")): >> print "/ does not exist" >> else: >> print "/ exists" >> if not (os.path.isdir("/")): >> print "/ is not a directory" >> else: >> print "/ ok" >> >> if name == " main ": >> main() >> >> The output is: >> >> / exists >> / is not a directory >> >> It's the same for every (existing) directory name I try: >os.path.isdir() >> always returns false. >> >> It looks as if the stat results are not recognised: os.path.exists() >> works, but all the functions os.path.isdir(), os.path.isfile() etc. >> don't. >> >> Could anyone help me to solve the problem? > >Unless there are other Reliant users here ahead of you, some >of it is going to be up to you. If you follow isdir() back, >you'll find some hard-coded octal bitmask definitions, including >S_IFDIR = 004. > >Check it out. Try to use that value the way they're using it, >in C and in Python, and print out all the values involved. >At worst, if C comes out wrong too, you may have a question >that the vendor will be more likely to respond to. First, thanks very much for your help. On the Reliant Unix system, C and Python both use the value you mention above. I added some debug prints to isdir in Lib/posixpath.py in the build tree: def isdir(path): """Test whether a path is a directory""" try: st = os.stat(path) print "isdir: OK, path: %s" % path print "st: %s" % st print "size, mtime, atime, ctime, dev, ino:" print "%s %s %s %s %s %s" % (st.st_size, st.st_mtime, st.st_atime, st.st_ctime, st.st_dev, st.st_ino) except os.error: print "isdir: OS.ERROR, path: %s" % path return False return stat.S_ISDIR(st.st_mode) and to S_ISDIR in Lib/stat.py: def S_ISDIR(mode): print "S_ISDIR: S_IFMT(mode): %s, S_IFDIR: %d" % (S_IFMT(mode), S_IFDIR) print "mode: %s" % mode return S_IFMT(mode) == S_IFDIR Then my sample program (see quote above) produces the following output: isdir: OK, path: /usr/local/lib/python2.4/site-packages st: (2, 1088705490076141L, 1050758L, 0, 1, 0, 4797493958154069376L, 87000, 87000, 0) size, mtime, atime, ctime, dev, ino: 4797493958154069376 87000 87000 0 1050758 1088705490076141 S_ISDIR: S_IFMT(mode): 0, S_IFDIR: 16384 mode: 2 isdir: OK, path: /usr/local/lib/site-python st: (2, 1088653950468589L, 1050758L, 0, 1, 0, 4797493958164069376L, 88000, 88000, 0) size, mtime, atime, ctime, dev, ino: 4797493958164069376 88000 88000 0 1050758 1088653950468589 S_ISDIR: S_IFMT(mode): 0, S_IFDIR: 16384 mode: 2 / exists isdir: OK, path: / st: (48, 8589951469L, 1050752L, 0, 0, 0, 4797500748297364352L, 12000, 12000, 6) size, mtime, atime, ctime, dev, ino: 4797500748297364352 12000 12000 6 1050752 8589951469 S_ISDIR: S_IFMT(mode): 0, S_IFDIR: 16384 mode: 48 / is not a directory The stat values do not make any sense. It seems that the value used for the mode is really the numbers of links (I created the two empty /usr/local... directories to prevent the os.error exception): $ ls -ldi /usr/local/lib/python2.4/> 2 drwxr-xr-x 48 root root2560 May 14 09:02 / 253484 drwxr-xr-x 2 root other 96 May 25 08:46 /usr/local/lib/python2.4/site-packages 253472 drwxr-xr-x 2 root other 96 May 25 08:46 /usr/local/lib/site-python I'm a very beginner with Python and I'm not at all familiar with the build structure of Python. (I just wanted to setup a Subversion repository and to run some contributed Python hook scripts.) It would be very helpful if you could give me some hint in which source and function the C stat() results are mapped to the stat values accessible from Python. Then I can try a bit debugging there. - Servatius Servatius Brandt Phone: +49 89 636-41504 Fujitsu Siemens ComputersFax: +49 89 636-48716 EP SW AD C++ Email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Build error Python 2.4.1 - stat problem?
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: ... > I used the python executable from the build directory to run the > following program: > > import os > > def main(): > if not (os.path.exists("/")): > print "/ does not exist" > else: > print "/ exists" > if not (os.path.isdir("/")): > print "/ is not a directory" > else: > print "/ ok" > > if name == " main ": > main() > > The output is: > > / exists > / is not a directory > > It's the same for every (existing) directory name I try: os.path.isdir() > always returns false. > > It looks as if the stat results are not recognised: os.path.exists() > works, but all the functions os.path.isdir(), os.path.isfile() etc. > don't. > > Could anyone help me to solve the problem? Unless there are other Reliant users here ahead of you, some of it is going to be up to you. If you follow isdir() back, you'll find some hard-coded octal bitmask definitions, including S_IFDIR = 004. Check it out. Try to use that value the way they're using it, in C and in Python, and print out all the values involved. At worst, if C comes out wrong too, you may have a question that the vendor will be more likely to respond to. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Build error Python 2.4.1 - stat problem?
Hello, I tried to build Python 2.4.1 on a Reliant Unix system. Just after the python executable program has been built, I get the following error: begin make output === CC -W1 -Blargedynsym -o python \ Modules/python.o \ libpython2.4.a -lresolv -lsocket -lnsl -ldl -lm case $MAKEFLAGS in \ *-s*) CC='cc' LDSHARED='ld' OPT='-DNDEBUG -O' ./python -E ./setup.py -q build;; \ *) CC='cc' LDSHARED='ld' OPT='-DNDEBUG -O' ./python -E ./setup.py build;; \ esac Traceback (most recent call last): File "./setup.py", line 1088, in ? class PyBuildInstallLib(install_lib): File "./setup.py", line 1094, in PyBuildInstallLib so_ext = sysconfig.get_config_var("SO") File "/build_dir/Python-2.4.1/Lib/distutils/sysconfig.py", line 511, in get_config_var return get_config_vars().get(name) File "/build_dir/Python-2.4.1/Lib/distutils/sysconfig.py", line 488, in get_config_vars func() File "/build_dir/Python-2.4.1/Lib/distutils/sysconfig.py", line 358, in _init_posix raise DistutilsPlatformError(my_msg) distutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /usr/local/lib/python2.4/config/Makefile (No such file or directory) make: *** Error code 1 make: Fatal error. end make output === It is strange that the Makefile complains about /usr/local/lib/python2.4 since this is still the build phase, far away from the installation into /usr/local. I used the python executable from the build directory to run the following program: import os def main(): if not (os.path.exists("/")): print "/ does not exist" else: print "/ exists" if not (os.path.isdir("/")): print "/ is not a directory" else: print "/ ok" if __name__ == "__main__": main() The output is: / exists / is not a directory It's the same for every (existing) directory name I try: os.path.isdir() always returns false. It looks as if the stat results are not recognised: os.path.exists() works, but all the functions os.path.isdir(), os.path.isfile() etc. don't. Could anyone help me to solve the problem? - Servatius Servatius Brandt Phone: +49 89 636-41504 Fujitsu Siemens ComputersFax: +49 89 636-48716 EP SW AD C++ Email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list