473,770 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

hidden built-in module

Hello, is there a way to access a module that is hidden because
another module (of the same name) is found first?

More specifically, i have my own logging.py module, and inside this
module, depending on how initialization goes, i may want to do 'from
logging import *' from the built-in logging.

I hope my description was clear, cheers.

I am using python2.4.
Mar 7 '08 #1
5 1526
koara wrote:
Hello, is there a way to access a module that is hidden because
another module (of the same name) is found first?

More specifically, i have my own logging.py module, and inside this
module, depending on how initialization goes, i may want to do 'from
logging import *' from the built-in logging.

I hope my description was clear, cheers.

I am using python2.4.
you can add your own logging module in extra directory that have __init__.py and
import it like: from extradirectory. logging import *

and builtin: from logging import *
Mar 7 '08 #2
On Mar 5, 1:39 pm, gigs <g...@hi.t-com.hrwrote:
koara wrote:
Hello, is there a way to access a module that is hidden because
another module (of the same name) is found first?
More specifically, i have my own logging.py module, and inside this
module, depending on how initialization goes, i may want to do 'from
logging import *' from the built-in logging.
I hope my description was clear, cheers.
I am using python2.4.

you can add your own logging module in extra directory that have __init__.py and
import it like: from extradirectory. logging import *

and builtin: from logging import *

Thank you for your reply gigs. However, the point of this namespace
harakiri is that existing code which uses 'import logging' ...
'logging.info() '... etc. continues working without any change.
Renaming my logging.py file is not an option -- if it were, i wouldn't
bother naming my module same as a built-in :-)

Cheers.
Mar 7 '08 #3
koara schrieb:
On Mar 5, 1:39 pm, gigs <g...@hi.t-com.hrwrote:
>koara wrote:
>>Hello, is there a way to access a module that is hidden because
another module (of the same name) is found first?
More specifically, i have my own logging.py module, and inside this
module, depending on how initialization goes, i may want to do 'from
logging import *' from the built-in logging.
I hope my description was clear, cheers.
I am using python2.4.
you can add your own logging module in extra directory that have __init__.py and
import it like: from extradirectory. logging import *

and builtin: from logging import *


Thank you for your reply gigs. However, the point of this namespace
harakiri is that existing code which uses 'import logging' ...
'logging.info() '... etc. continues working without any change.
Renaming my logging.py file is not an option -- if it were, i wouldn't
bother naming my module same as a built-in :-)
You can only try and search the sys-path for the logging-module, using

sys.prefix

and then look for logging.py. Using

__import__(path )

you get a reference to that module.

Diez
Mar 7 '08 #4
En Fri, 07 Mar 2008 12:15:04 -0200, koara <ko***@atlas.cz escribi�:
On Mar 5, 1:39 pm, gigs <g...@hi.t-com.hrwrote:
>koara wrote:
Hello, is there a way to access a module that is hidden because
another module (of the same name) is found first?
More specifically, i have my own logging.py module, and inside this
module, depending on how initialization goes, i may want to do 'from
logging import *' from the built-in logging.

you can add your own logging module in extra directory that have
__init__.py and
import it like: from extradirectory. logging import *
and builtin: from logging import *

Thank you for your reply gigs. However, the point of this namespace
harakiri is that existing code which uses 'import logging' ...
'logging.info() '... etc. continues working without any change.
Renaming my logging.py file is not an option -- if it were, i wouldn't
bother naming my module same as a built-in :-)
Read a very recent post from Bruno Desthuilliers with subject "Altering
imported modules"

--
Gabriel Genellina

Mar 7 '08 #5
You can only try and search the sys-path for the logging-module, using
>
sys.prefix

and then look for logging.py. Using

__import__(path )

you get a reference to that module.

Diez

Thank you Diez, that's the info i'd been looking for :-)

So the answer is sys module + __import__

Cheers!
Mar 7 '08 #6

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

Similar topics

2
2221
by: Ron Aronica | last post by:
I want to specify the value of an input field using the return from a function. I want to do something this this: <script> function value() { return "the value"; } </script> <form>
2
2644
by: D. Alvarado | last post by:
Hello I have 5 divs, and initially the lower 4 are hidden. I would like everything beneath the 5th div to appear flush against the first visible div. But right now, there is a gap of white space between the first visible div, and everything beneath the 5th. Here is this code: <form name="f"> <div id="Item0">Item 1:<input type="text" size="32" maxlength="32" name="Name0" id="Name0"></div>
5
7706
by: sams | last post by:
I've seen this covered before, but I just don't understand Java very well. I apologize if this is a repeat. Basically, I need a text/java style submit form with multiple hidden fields. It would take the place of the following standard submit button: <form action="ProductQuery.cfm" name="LineCode" method="post"> <input type="hidden" name="Year" value="#GetProducts.Year#"> <input type="hidden" name="Make" value="#GetProducts.Make#">
2
15627
by: Christoph | last post by:
Is there any way you can trigger a function when the value of a hidden form element is changed? thnx, Christoph
6
3904
by: Angus Comber | last post by:
Hello I am working with an external perl script. I can submit something like this: <form target="mycart" action="https://www.website.com/cgi-bin/" method="post"> <input type="image" src="https://www.website.com/btn/click-but.gif" border="0"
3
4977
by: Dale | last post by:
Is there a way to determine the number of hidden files/directories within a directory? This is what I’m doing now: System.IO.DirectoryInfo rootPath; System.IO.FileSystemInfo dirs, files; int numOfDirs = 0, numOfFiles = 0; di = new System.IO.DirectoryInfo(“blah”); dirs = rootPath.GetDirectories(); files = rootPath.GetFiles();
3
2350
by: Christian Blackburn | last post by:
Hi Gang, All I want is to be able to search a file for files matching a certain criteria. However, VB seems heart set on returning hidden folders along with my list of files. I've tried the following: strFile = Dir(strPath, FileAttribute.Archive Or FileAttribute.Hidden Or FileAttribute.ReadOnly Or FileAttribute.System) and this which shouldn't be necessary strFile = Dir(strPath, FileAttribute.Archive Or FileAttribute.Hidden Or
5
1994
by: anonymousstar | last post by:
Hi all, I am new to these forums and decided to join one (this one) after 5 days of researching to try and solve my problem. I am creating a booking type of calendar. It will be run by an oracle database. From the front end a user will see all the dates that are available (green cells), dates that are pending (orange cells) and dates that are booked (red cells); the user will then click on the dates that are available they want to book,...
5
7345
by: dmorand | last post by:
I'm having a strange issue with a form I'm developing. I'm saving some values to hidden fields when a user clicks a button. I setup a function which gets ran on submission of the form, but I also placed this function on my submission button when clicked. <input name="button5" type="button" class="Buttons" id="button5" value="On File" OnClick="setup_req('cpr_onfile',1);"/> <input type="hidden" name="cert_onfile"/> ..... <cfform...
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9454
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,...
0
10260
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, 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...
0
10101
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 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...
0
9906
tracyyun
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...
0
8933
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 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...
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
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...

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.