Windows command line not displaying print commands

John Machin sjmachin at lexicon.net
Tue Mar 31 04:18:30 EDT 2009


On Mar 31, 9:57 am, JonathanB <doulo... at gmail.com> wrote:
> On Mar 30, 6:28 pm, John Machin <sjmac... at lexicon.net> wrote:
>
> > On Mar 31, 8:37 am, Irmen de Jong <irmen.NOS... at xs4all.nl> wrote:
> > > Does just typing:
>
> > >    python
>
> Yes, just typing python takes me to my interactive prompt
>
> > > Or do you have a module in your E:\Python\dev directory called 'os', 'sys' or something
> > > else that may clobber one of the default library modules.
>
> The only module in the directory is called pyfind.py

So what do you classify hello.py as? A script?

Please tell us what other files are in the directory.


>
>
>
> > or perhaps there's a file named python.bat that does nothing.
>
> > What directory is Python installed in? What does your Windows PATH
> > look like? Is this your very first attempt to do anything at all with
> > Python or have you managed to get any output from a Python script
> > before? If the latter, what have you changed in your environment? Does
> > E: refer to a removable disk?
>
> Unfortunately, this problem is on my work computer, so I'm not in
> front of it right now. I've done the development on this in
> PortablePython, but I have python installed in C:/Python25 and that
> should be in my path (I went though and added it). I've never run a
> script that output to the command line before, only django apps.
> Django will output stuff though, which makes me wonder if I've somehow
> borked my stdout in the script. Not sure how I could have done that,
> but I'll post the script I've written in the next post just in case
> I'm somehow messing up the calls (although "print var" seems fairly
> user-proof...). E: does refer to a removable disc.

If hello.py doesn't print,  then the problem is unlikely to be in your
big script.

I suspect that your best approach would be to (a) ensure that you have
the latest release of Portable Python [there was one in the last few
days] and (b) ask the author for help.

Other things to try that might diagnose where the problem really is:
just follow my example below.


| C:\junk>python -c "print 9876"
| 9876
|
| C:\junk>python
| Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on
| win32
| Type "help", "copyright", "credits" or "license" for more
information.
| >>> print "hello"
| hello
| >>> print 9876
| 9876
| >>> ^Z
|
|
| C:\junk>copy con test1.py
| print 9876
| ^Z
|         1 file(s) copied.
|
| C:\junk>python test1.py
| 9876
|
| C:\junk>copy con test2.py
| 1 / 0
| ^Z
|         1 file(s) copied.
|
| C:\junk>python test2.py
| Traceback (most recent call last):
|   File "test2.py", line 1, in <module>
|     1 / 0
| ZeroDivisionError: integer division or modulo by zero
|

HTH,
John



More information about the Python-list mailing list