Picon
Gravatar

[ANN] SciPy India conference in Dec. 2009

Greetings,

The first "Scientific Computing with Python" conference in India
(http://scipy.in) will be held from December 12th to 17th, 2009 at the
Technopark in Trivandrum, Kerala, India (http://www.technopark.org/).

The theme of the conference will be "Scientific Python in Action" with
respect to application and teaching.  We are pleased to have Travis
Oliphant, the creator and lead developer of numpy
(http://numpy.scipy.org) as the keynote speaker.

Here is a rough schedule of the conference:

     Sat.    Dec. 12  (conference)
     Sun.    Dec. 13  (conference)
     Mon.    Dec. 14  (tutorials)
     Tues.   Dec. 15  (tutorials)
     Wed.    Dec. 16  (sprint)
     Thu.    Dec. 17  (sprint)

The tutorial sessions will have two tracks, one specifically for
teachers and one for the general public.

There are no registration fees.

Please register at:

         http://scipy.in

The call for papers will be announced soon.
(Continue reading)

Picon
Favicon

compiling on windows

Hello,

compiling ipython on windows has some catches.  installing from source this way doesn't create a .bat file,
or put anything in the Start Menu.  The installation instructions encourage using 'setupegg.py' to
resolve this.  'setupegg.py' invokes setuptools.

I'd like to avoid using setuptools if at all possible, and wondered if I could just use 'setup.py' on
windows, and do the rest of the work myself.  Does anyone have instructions to do this?  Or, perhaps can
provide a hint on how I might figure out what needs to be in this .bat file?

-Chandler
Mike Blatchley | 7 Oct 04:56
Picon

FakeModule and python's __main__ module

A friend of mine has recently introduced me to IPython and I'm hooked.  I've been using an older version (0.8.x), but have now downloaded 0.10 and am having trouble with some of my existing python scripts.  In a few of these, I get lazy with "returning" certain objects from methods.  Instead of returning them, I place them directly in the main/interactive namespace with the __main__ module.

def someFunction():
    import __main__
    # do some stuff here
    __main__.myObject=myObject
    #etc.

When I return to the interactive prompt, myObject isn't there.  Conversely, sometimes I try to retrieve "global" attributes from that namespace, but now get an error.  For example:

In [16]: myObject=None
In [17]: def test():
   ....:     import __main__
   ....:     print __main__.myObject
In [18]: test()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\work\test\<ipython console> in <module>()
C:\work\test\<ipython console> in test()
AttributeError: 'FakeModule' object has no attribute 'myObject'

I've done searches on FakeModule and see quite a few mailing list postings indicating it replaces python's __main__, but am unclear if there is any way around my problem.  That is, other than sticking with the older releases of IPython.  Or rewriting my affected methods to not use __main__.

Any suggestions would be much appreciated.

Thanks much,
Mike

_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Kenneth Arnold | 7 Oct 05:02
Picon

Re: FakeModule and python's __main__ module

With tab completion, pretty printing, and output history management, I
think you'll find that IPython handles normally returned values quite
well.

If you still have extensive side-channel data (and logging, etc.
doesn't cut it), you could add that data as an attribute on whatever
object you're returning, or make a module-global dictionary that you
update. I've never felt the need to do those things, though. Keep even
your API clean; you'll thank yourself later :)

-Ken

On Tue, Oct 6, 2009 at 10:56 PM, Mike Blatchley <mabxmab <at> gmail.com> wrote:
> A friend of mine has recently introduced me to IPython and I'm hooked.  I've
> been using an older version (0.8.x), but have now downloaded 0.10 and am
> having trouble with some of my existing python scripts.  In a few of these,
> I get lazy with "returning" certain objects from methods.  Instead of
> returning them, I place them directly in the main/interactive namespace with
> the __main__ module.
>
> def someFunction():
>     import __main__
>     # do some stuff here
>     __main__.myObject=myObject
>     #etc.
>
> When I return to the interactive prompt, myObject isn't there.  Conversely,
> sometimes I try to retrieve "global" attributes from that namespace, but now
> get an error.  For example:
>
> In [16]: myObject=None
> In [17]: def test():
>    ....:     import __main__
>    ....:     print __main__.myObject
> In [18]: test()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent
call last)
> C:\work\test\<ipython console> in <module>()
> C:\work\test\<ipython console> in test()
> AttributeError: 'FakeModule' object has no attribute 'myObject'
>
> I've done searches on FakeModule and see quite a few mailing list postings
> indicating it replaces python's __main__, but am unclear if there is any way
> around my problem.  That is, other than sticking with the older releases of
> IPython.  Or rewriting my affected methods to not use __main__.
>
> Any suggestions would be much appreciated.
>
> Thanks much,
> Mike
>
>
> _______________________________________________
> IPython-user mailing list
> IPython-user <at> scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-user
Picon

run -d crashes

Hi!

under ubuntu Jaunty (64bits), IPython 0.10
and with Python 2.6.2,

run -d myscript would crash with the following:

In [1]: run -d test_run.py
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/jfmoulin/Temp/≤ipython console> in <module>()

/usr/local/lib/python2.6/dist-packages/IPython/iplib.pyc in
ipmagic(self, arg_s)
   1180         else:
   1181             magic_args = self.var_expand(magic_args,1)
-> 1182             return fn(magic_args)
   1183
   1184     def ipalias(self,arg_s):

/usr/local/lib/python2.6/dist-packages/IPython/Magic.pyc in
magic_run(self, parameter_s, runner, file_finder)
   1631                     maxtries = 10
   1632                     bp = int(opts.get('b',[1])[0])
-> 1633                     checkline = deb.checkline(filename,bp)
   1634                     if not checkline:
   1635                         for bp in range(bp+1,bp+maxtries+1):

/usr/lib/python2.6/pdb.pyc in checkline(self, filename, lineno)
    450         line or EOF). Warning: testing is not comprehensive.
    451         """
--> 452         line = linecache.getline(filename, lineno,
self.curframe.f_globals)
    453         if not line:
    454             print >>self.stdout, 'End of file'

AttributeError: Pdb instance has no attribute 'curframe'
Picon

access to __main__

Hi!

a maybe stupid namespace question....
I am trying to launch some configuration scripts (for an instrument we
control with python) at ipython's startup, to avoid the burden of typing
run foo.py at each startup (foo is actually a long list of foos and bars)

I used a specific ipythonrc-myenv configuration file which includes a
execfile ./nicos/refsansstartup_ipy.py statement.

ipython -pylab -profile myenv  crashes with the following

....
     67 import __main__
     68
#---------------------------------------------------------------------------
---> 69 Developing = __main__.Developing
     70 readonly   = __main__.readonly
     71 fake       = __main__.fake

AttributeError: 'FakeModule' object has no attribute 'Developing'
WARNING: Failure executing file: <./nicos/refsansstartup_ipy.py>

So it seems that I do not have access to the 'real' __main__ where these
   flags are created.

I have previously been playing with the ipython user space but I am a
bit puzzled here because if, in interactive mode I type
run ./nicos/refsansstartup_ipy.py everything runs fine... (which as far
as i remember was not the case last time I had to look in ipython's user
namespace). It is even more so puzzling for me when I think that I
should have used run -i to access the interactive variables.... (should
not I ?)

Side comment, if you have a strong opinion or tips about sharing global
flags across modules, please express yourself but please note that the
core of my question really is about ipython, not about using __main__ as
a mailbox!

Thanks for helping

JF
Robert Kern | 7 Oct 17:26
Picon
Gravatar

Re: access to __main__

On 2009-10-07 07:32 AM, Jean-Francois Moulin wrote:

> Side comment, if you have a strong opinion or tips about sharing global
> flags across modules, please express yourself but please note that the
> core of my question really is about ipython, not about using __main__ as
> a mailbox!

Use module specifically for that purpose, not __main__. IPython needs to fiddle 
with __main__ in various ways (since it is a Python program running other Python 
programs in the same process), and that is interfering with your attempted use here.

--

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco
Jon Olav Vik | 7 Oct 21:25
Picon

Re: run -d crashes

Jean-Francois Moulin <jfrancis18 <at> gmail.com> writes:

> under ubuntu Jaunty (64bits), IPython 0.10
> and with Python 2.6.2,
> 
> run -d myscript would crash with the following:
[...]
> AttributeError: Pdb instance has no attribute 'curframe'

Google is your friend.
http://www.google.com/search?q=AttributeError:+Pdb+instance+has+no+attribute
+'curframe'
will give you this:
https://bugs.launchpad.net/ipython/+bug/381069
Picon

easy way to display contents of a file with page pauses?


Is there a command that I can issue from within IPython to display the
contents of a file, with a pause after each page?  (I'm looking for
something akin to the Unix 'more' command).
--

-- 
View this message in context: http://www.nabble.com/easy-way-to-display-contents-of-a-file-with-page-pauses--tp25803274p25803274.html
Sent from the IPython - User mailing list archive at Nabble.com.
Robert Kern | 8 Oct 19:01
Picon
Gravatar

Re: easy way to display contents of a file with page pauses?

On 2009-10-08 11:12 AM, Dr. Phillip M. Feldman wrote:
>
> Is there a command that I can issue from within IPython to display the
> contents of a file, with a pause after each page?  (I'm looking for
> something akin to the Unix 'more' command).

Use the ! prefix to run the program you normally would use in your regular 
shell. E.g.

In [1]: !less a_really_big_file.txt

--

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

Gmane