Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8346471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:01:34+00:00 2026-06-09T07:01:34+00:00

Where is ipython’s configuration file, which starts with c = get_config() , executed? I’m

  • 0

Where is ipython’s configuration file, which starts with c = get_config(), executed? I’m asking because I want to understand what order things are done in ipython, e.g. why certain commands will not work if included as c.InteractiveShellApp.exec_lines.

This is related to my other question, Log IPython output?, because I want access to a logger attribute, but I can’t figure out how to access it in the configuration file, and by the time exec_lines are run, the logger has already started (it’s too late).

EDIT: I’ve accepted a solution based on using a startup file in ipython0.12+. Here is my implementation of that solution:

from time import strftime
import os.path

ip = get_ipython()

#ldir = ip.profile_dir.log_dir 
ldir = os.getcwd()
fname = 'ipython_log_' + strftime('%Y-%m-%d') + ".py"
filename = os.path.join(ldir, fname)
notnew = os.path.exists(filename)


try:
  ip.magic('logstart -o %s append' % filename)
  if notnew:
      ip.logger.log_write( u"########################################################\n" ) 
  else:
      ip.logger.log_write( u"#!/usr/bin/env python\n" )
      ip.logger.log_write( u"# " + fname + "\n" )
      ip.logger.log_write( u"# IPython automatic logging file\n" )
  ip.logger.log_write( u"# " + '# Started Logging At: '+ strftime('%Y-%m-%d %H:%M:%S\n') ) 
  ip.logger.log_write( u"########################################################\n" ) 
  print " Logging to "+filename
except RuntimeError:
    print " Already logging to "+ip.logger.logfname

There are only two subtle differences from the proposed solution linked:
1. saves log to cwd instead of some log directory (though I like that more…)
2. ip.magic_logstart doesn’t seem to exist, instead one should use ip.magic('logstart')

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:01:36+00:00Added an answer on June 9, 2026 at 7:01 am

    The config system sets up a special namespace containing the get_config() function, runs the config file, and collects the values to apply them to the objects as they’re created. Referring to your previous question, it doesn’t look like there’s a configuration value for logging output. You may want to start logging yourself after config, when you can control it more precisely. See this example of starting logging automatically.

    Your other question mentions that you’re limited to 0.10.2 on one system: that has a completely different config system that won’t even look at the same file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using IPython Notebook and want to ramp things up and get the
I have a few IPython scripts which have redundant functionality. I would like to
Sometimes when using ipython you might hit an exception in a function which has
Trying to install this ipython version. infact there's a django-starter project which uses buildout
I am trying to install Ipython 0.12 on to python 2.7. Because I'm using
I could not understand the ipython library. This url provide the common feature but
I want to parallelize a function using IPython.parallel, and when I define it in
I do that without the IDE: $ ipython $ edit file.py $ :x (save
I've grown accustomed to using IPython to try things out whilst learning Python, and
I tried echo print 'hello' | ipython Which runs the command but ipython immediately

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.