Win98 PySol problem

Kragen Sitaker kragen at canonical.org
Mon Nov 26 15:25:21 EST 2001


"Bill Melcher" <wpmelcher at snet.net> writes:

> "Kragen Sitaker" <kragen at canonical.org> wrote in message
> news:83r8qmtgu9.fsf at panacea.canonical.org...
> > "Bill Melcher" <wpmelcher at snet.net> writes:
> Unfortunately, Python seems to mess up the DOS redirection so that in the
> command line above, the '>python.txt' fragment creates the .txt file in C:\
> but the output is not redirected to that file. The ability to specify "|
> more" is also crippled by python.  I caught the console output by using the
> Pause key and typing what I saw into an editor.

That stuff gets written to stderr for no particularly good reason, so
redirecting stdout won't help.  I don't think MS-DOS gives you a way
to redirect stderr.

(You know there's a 'Copy' on the DOS console window's menu, right?
Under Edit?)

> > Well, running it in a console window will save the last
> > scroll-buffer-full.  You can set your scrollback buffer size (on
> > better versions of Windows) with some Properties dialog --- I can't
> > remember where.
> 
> I'll see if I can track this down.

I think you might have to create a shortcut and set the shortcut
properties, but I'm not sure Win98 supports it at all.

> > There's little bits of python you could do to save the messages to a
> > file.  I think you can say:
> > import sys
> > sys.stdout = file.open("output", w)
> > sys.stderr = sys.stdout
> > execfile "Q:\\pysol-4.2\\src\\pysol.py"
> 
> I would presume that I should run this in pythonwin or ppm or idle.  I will
> give it a shot.

In Pythonwin or Idle, you might have a scrollbar on your evaluation
window.  (I don't know what ppm is, and I don't use Pythonwin or
Idle.)  In that case, maybe you could just run the execfile line.

> > > Another topic is a file called ".gdbinit" which contains:
> > >
> > > file python
> > > set args -u -t pysol.py
> > >
> > > What the heck is this?
> >
> > Sounds like an initialization file for the GNU debugger, to set it up
> > to run your Python command under the debugger.  Dunno why Python
> > recorded this.  Mine sure doesn't.
> 
> Sorry, I confused you.  This is a file in the PySol source.

That makes a lot more sense.  It's there to make it easier to run
PySol under the GNU debugger.

> The whole situation is made more confusing because I have very
> little Unix understanding while you guys tend to be weak on Win98.

Yes, and with good reason.  :)

> In essense, I need to figure out who's doing what to whom, then burrow down
> into which ever product is giving me grief --

PySol, obviously.  I just type 'sudo apt-get install pysol', and I
have...  a pysol command that tells me 'bad .pyc magic number'.  So I
delete /usr/share/pysol/pysol.pyc, which is the file strace pysol
tells me python is accessing right before it dies, and... 'can't open
/usr/share/pysol/pysol.pyc'.  Well, sure.  And there's no apparent way
to create it.

So I sudo apt-get remove pysol, apt-get source pysol, discover apt-get
source is missing 'dpkg-source', figure out that dpkg-source is in the
'dpkg-dev' package, sudo apt-get install dpkg-dev, then apt-get source
pysol again.

Now Python still complains about a bad magic number in pysol.pyc, but
I also have a src directory, and when I cd src and python pysol.py,
everything works.

(Turns out pysol ships with a .pyc file built for Python 1.5.2, and I
have Python 2.1.1 installed.)

HTH.




More information about the Python-list mailing list