[IronPython] dir and urllib (utter newbie questions)

Curt Hagenlocher curt at hagenlocher.org
Sat Jul 14 18:09:44 CEST 2007


On 7/14/07, David Seruyange <idmkid at yahoo.com> wrote:
>
> I'm very new to Python and had a few questions.  Does dir() only work from
> the ipy interpreter?  If I attempt the following:
>
> >>> from System import *
> >>> dir()
>
> It sucesssfully prints everything available but when I try the two lines
> of code from a script and run:
>
> ipy test.py
>
> Nothing prints.
>

That's because dir() doesn't print anything.  It merely returns a list of
values that the interpreter prints.  When you run it from the file, there
isn't a command line interpreter printing the results of any expressions.
If you said "print dir()" instead of just "dir()", your program would do
what you expect.

One more question: does urllib come with Iron Python?
>

None of the standard Python library comes with IronPython, but the intent
for IronPython is that it should support the standard Python library, so you
could just download CPython and try to use it.  Alternatively, check out
http://fepy.sourceforge.net/ as a one-stop-shop.

--
Curt Hagenlocher
curt at hagenlocher.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20070714/429ab2bf/attachment.html>


More information about the Ironpython-users mailing list