473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

gettext and the interpreter

Recently I wanted to do some debugging using one module of my first
Python program using the gettext module. I just didn't find a way to
disable the interpreter binding the last result to _, which ought to
be (and stay) a function.

Anybody got an idea how to do it?

Hans-Joachim
Jul 18 '05 #1
1 1278
Hans-Joachim Widmaier wrote:
Recently I wanted to do some debugging using one module of my first
Python program using the gettext module. I just didn't find a way to
disable the interpreter binding the last result to _, which ought to
be (and stay) a function.

Anybody got an idea how to do it?


Try redefining sys.displayhook, e. g.:
import sys, __builtin__
def myhook(value): .... if value is not None:
.... __builtin__.__last__ = value
.... sys.stdout.write("%r\n" % value)
.... sys.displayhook = myhook
Now the last non-None value will be stored in __last__ instead of _:
1 1 _ Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError: name '_' is not defined __last__

1

Peter

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Daniel CAUSSE | last post by:
Hello, I'm testing gettext on my website but it doesn't work. phpinfo returns correct informations: configure command => '--with-gettext=/usr' GetText Support => enabled I have no problem...
1
by: Dave Patton | last post by:
Can someone point me to a definitive source for the answers to the following two questions: 1) In an environment with Redhat Linux 2.4.21-27.0.1, Apache 1.3.31, PHP 4.3.10, and GNU gettext...
7
by: Richard Shea | last post by:
Hi - I'd like to try applying internationalisation techniques to get an idea of how much extra work is involved. As a first step I'm looking at the class based gettext. I just wondered if anyone...
14
by: Pierre Rouleau | last post by:
I have a problem writing self-testable modules using doctest when these modules have internationalized strings using gettext _('...'). - The main module of an application (say app.py) calls...
1
by: Terry Hancock | last post by:
I'm looking at the gettext module for the first time and learning how to write internationalized code in Python. Naturally, I also looked at the original Gnu gettext manual, which mentions that...
13
by: cantabile | last post by:
Hi, I'm failing to make it work but can't find out what's wrong. Here's what I do : ================ test.py import gettext gettext.install('')
1
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details...
6
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I've encountered a problem using gettext with properties while using a Python interpreter. Here's a simple program that illustrate the problem. ============== # i18n_test.py: test of gettext &...
2
by: paolob | last post by:
Hi to all, I'm running php 5.2.5 on Debian etch, with apache 2.0.56. I need to include, in php.ini, gettext.so library but I didn't find anything. I've already install: apt-get install gettext...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.