A project I'm currently working on uses Turbogears as a framework. I'd
like to interact with it using the tg-admin shell. We also use gettext's
_() function for internationaliz ation. Now, this function is overwritten
in interactive mode, which causes annoying exceptions. Is it possible to
disable this behavior? 3 1389
Koen Vossen wrote:
A project I'm currently working on uses Turbogears as a framework. I'd
like to interact with it using the tg-admin shell. We also use gettext's
_() function for internationaliz ation. Now, this function is overwritten
in interactive mode, which causes annoying exceptions. Is it possible to
disable this behavior?
>>import sys def displayhook(res ult):
.... if result is not None:
.... __builtins__._l ast = result
.... print result
....
>>"yadda"
yadda
>>_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_' is not defined
>>_last
yadda
Peter
Koen Vossen wrote:
A project I'm currently working on uses Turbogears as a framework. I'd
like to interact with it using the tg-admin shell. We also use gettext's
_() function for internationaliz ation. Now, this function is overwritten
in interactive mode, which causes annoying exceptions. Is it possible to
disable this behavior?
[correct overzealous snip]
>>import sys def displayhook(res ult):
.... if result is not None:
.... __builtins__._l ast = result
.... print result
....
>>sys.displayho ok = displayhook _
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_' is not defined
>>"yadda"
yadda
>>_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_' is not defined
>>_last
yadda
Peter
Peter Otten <__*******@web. dewrites:
>import sys def displayhook(res ult):
... if result is not None:
... __builtins__._l ast = result
... print result
...
Better is to explicitly import the name '__builtin__'
<URL:http://www.python.org/doc/lib/module-builtin>. The name
'__builtins__' is an implementation detail not guaranteed to be
present in any particular implementation.
import __builtin__
import sys
def displayhook(res ult):
if result is not None:
__builtin__._la st = result
print result
--
\ “If you continue running Windows, your system may become |
`\ unstable.” —Microsoft, Windows 95 error message |
_o__) |
Ben Finney This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sbd! |
last post by:
I had a problem with string which have some \ chars at the end of the
string. For example:
$String = "I want this **** out of here\\\\\\\\\";
I needed to remove it useing regular expression...i thinked that
something like "/\\+$/" is enough but i was wrong. I made some tries
and finaly i removed "\" chars it with "/\\\+$/". It works (i'm proud
with myself :)), but i can't understand why \\\ matchs single \, and \\
not...
|
by: Roy Yao |
last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ?
According to my analysis, operator sizeof, (type) and * have the same
precedence, and they combine from right to left. Then this expression should
equal to "sizeof( (int)(*p) )", but the compiler does NOT think so. Why?
Can anyone help me? Thanks.
Best regards.
Roy
|
by: Scott W Gifford |
last post by:
Hello,
I'm considering using XML to represent a stream of location
information, and XPath to do queries against it. I've got most of it
figured out (at least on paper), but I can't figure out how to create
an XPath statement asking for the "last node with a value less than" a
given value.
I need this to be able to ask "Where was Scott at 11:00 yesterday",
which should find the last sighting of Scott before or at 11:00
|
by: James Curran |
last post by:
I'd like to make the following proposal for a new feature for the C#
language. I have no connection with the C# team at Microsoft. I'm posting
it here to gather input to refine it, in an "open Source" manner, and in an
attempt to build a ground-swell of support to convince the folks at
Microsoft to add it.
Proposal: "first:" "last:" sections in a "foreach" block
The problem:
The foreach statement allows iterating over all the...
|
by: hn.ft.pris |
last post by:
Hi:
I have the following simple program:
#include<iostream>
using namespace std;
int main(int argc, char* argv){
const double L = 1.234;
const int T = static_cast<const int>(L);
int arr;
| |
by: =?Utf-8?B?SmFu?= |
last post by:
In my application the user can configure automation-scripts by inserting
different "actions" into a "procedure". These different procedure- and
action-objects are all translated into C# code before execution.
One "action" type is an expression-evaluator. At the moment the expression
the user writes into the action is just inserted into the generated C# code
unchanged.
The problem is the variables in my system and in the "procedures";...
|
by: jaime |
last post by:
Hi again all.
Given the line:
const int x=5;
Can I then use "x" as a constant expression? (By "constant expression", I
mean "constant expression" as defined in the C99 standard)
I've been searching google for 2 days now trying to answer this myself,
and I'm just getting more and more confused (some things I read make me
think "yes", while some things I read make me think "no").
|
by: Adem |
last post by:
C/C++ language proposal:
Change the 'case expression' from "integral constant-expression" to "integral expression"
The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15)
says under 6.4.2(2) :
case constant-expression :
I propose that the case expression of the switch statement
be changed from "integral constant-expression" to "integral expression".
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |