473,323 Members | 1,570 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,323 software developers and data experts.

importing module conflict

Hi,

Suppose I've a module named "urllib" and from it I need to import the
urllib module from the python standart library.

¿how can I do this?

The problem I found is that when I do:
import urrlib

The imported module is itself, and not the one from the stdlib.

Any idea?

Thanks a lot.

Jan 10 '08 #1
3 1619
Matias Surdi a écrit :
Hi,

Suppose I've a module named "urllib" and from it I need to import the
urllib module from the python standart library.

¿how can I do this?

The problem I found is that when I do:
import urrlib

The imported module is itself, and not the one from the stdlib.

Any idea?
Yes : don't name your module 'urllib' !-)

Else, you can play with sys.path before importing the std urllib, etc,
etc...
Jan 10 '08 #2
Matias Surdi <ma*********@gmail.comwrites:
Suppose I've a module named "urllib" and from it I need to import
the urllib module from the python standart library.
What you want is the "absolute import" behaviour, described in PEP 328
<URL:http://www.python.org/peps/pep-0328.htmland implemented in
Python 2.5 <URL:http://docs.python.org/whatsnew/pep-328.html>.

--
\ "The way to build large Python applications is to componentize |
`\ and loosely-couple the hell out of everything." -- Aahz |
_o__) |
Ben Finney
Jan 10 '08 #3
Ben Finney escribió:
Matias Surdi <ma*********@gmail.comwrites:
>Suppose I've a module named "urllib" and from it I need to import
the urllib module from the python standart library.

What you want is the "absolute import" behaviour, described in PEP 328
<URL:http://www.python.org/peps/pep-0328.htmland implemented in
Python 2.5 <URL:http://docs.python.org/whatsnew/pep-328.html>.
Thanks a lot.

That was exactly what I was looking for.Excellent.

Jan 10 '08 #4

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

Similar topics

2
by: plb | last post by:
All: I am struggling with an import problem... In my package, myapp, I have a module, logging.py. That module, naturally, imports the library module logging with an 'import logging'...
12
by: qwweeeit | last post by:
The pythonic way of programming requires, as far as I know, to spread a big application in plenty of more manageable scripts, using import or from ... import to connect the various modules. In...
4
by: JJ | last post by:
How can I import my current asp.net membership records in my local sql server to the empty tables on the live server? I've tried removing contraints with: ALTER TABLE aspnet_Applications...
2
by: krishna.000.k | last post by:
file1.py ---------- a = 20 from abc import * print "Should this be printed when 'a' is alone imported from this module" file2.py ---------- from file1 import a
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.