[Tutor] TKinter and things over Linux [how to make a transcript]

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed Apr 20 23:29:59 CEST 2005



On Wed, 20 Apr 2005, Alberto Troiano wrote:

> You're so right and I apologize for my mistake
>
> Do you or anybody knows where the error.log for this kind o things is?????
>
> or how can I capture the output in a file???????????Cause is so damn
> long that I barely see the 10% of all the things its print out


Hi Alberto,

On Unix, we can use a program called "script".  It's enormously useful.


Let's go through an example.  In my own copy of MySQL-python-1.2.0, I've
damaged my own setup.py: I've deliberately broken parts of the include
directory stuff to illicit a compile-time error.  This will show what kind
of errors we might expect to see from a missing MySQL setup.


Ok, let's start up the transcript.

######
[dyoo at shoebox dyoo]$ script
Script started, file is typescript
######


At this point, a file called 'typescript' is saved in the current working
directory.  It'll continue to record output until we 'exit'.

######
[dyoo at shoebox dyoo]$ cd MySQL-python-1.2.0
[dyoo at shoebox MySQL-python-1.2.0]$ python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension

... [output follows, as well as a LOT of error messages]

error: command 'gcc' failed with exit status 1
[dyoo at shoebox MySQL-python-1.2.0]$ exit
exit
Script done, file is typescript
######


Once things are done, I've 'exit'ed, and I have a nice 'typescript' which
records everything that I've done.



Let's do a quick inspection of that typescript:

######
[dyoo at shoebox dyoo]$ head -n 10 typescript
Script started on Wed Apr 20 14:15:02 2005
[dyoo at shoebox dyoo]$ cd MySQL-python-1.2.0
[dyoo at shoebox MySQL-python-1.2.0]$ python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC -I/usr/include/python2.3
-c _mysql.c -o build/temp.linux-i686-2.3/_mysql.o
_mysql.c:41:19: mysql.h: No such file or directory
_mysql.c:42:26: mysqld_error.h: No such file or directory
######

This is an example of an error message log.  The whole file contains exact
information that we need to see to duplicate the error.  I'll attach a
gzipped copy of it, just so you understand what we'd like to get back.


I'm only showing the first few lines of the transcript, but it includes
invaluable information.  What's most valuable here is seeing what flags
are being passed to gcc.  That is, it is very interesting that we see
something like:

    gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC -I/usr/include/python2.3
        -c _mysql.c -o build/temp.linux-i686-2.3/_mysql.o

because, for those C hackers amongst us, this looks wrong, because there's
a missing reference to the MySQL include directory.  And our suspicions
are confirmed when we see that gcc has trouble finding header files.  In
this particular case, we'd figure out that something has happened so that
setup.py isn't including a '-I/usr/include/mysql' as part of the compiler
argument list.


This is exactly why a full transcript is so useful: we see how things are
really running through the system.  There are lots of silly little
details, but they're invaluable when we're tracing errors.


I hope this helps!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample-typescript.gz
Type: application/octet-stream
Size: 2697 bytes
Desc: 
Url : http://mail.python.org/pipermail/tutor/attachments/20050420/2e589086/sample-typescript.obj


More information about the Tutor mailing list