Re: A question about import

2024-02-16 Thread Cameron Simpson via Python-list
On 16Feb2024 20:32, MRAB wrote: On 2024-02-16 20:07, Gabor Urban via Python-list wrote: I need something about modules to be clarified. Suppose I have written a module eg: ModuleA which imports an other module, let us say the datetime. If I import ModuleA in a script, will be datetime

Re: A question about import

2024-02-16 Thread MRAB via Python-list
On 2024-02-16 20:07, Gabor Urban via Python-list wrote: Hi guys, I need something about modules to be clarified. Suppose I have written a module eg: ModuleA which imports an other module, let us say the datetime. If I import ModuleA in a script, will be datetime imported automatically? Yes.

A question about import

2024-02-16 Thread Gabor Urban via Python-list
Hi guys, I need something about modules to be clarified. Suppose I have written a module eg: ModuleA which imports an other module, let us say the datetime. If I import ModuleA in a script, will be datetime imported automatically? Thanks in advance, -- Urbán Gábor Linux is like a wigwam: no

Re: Question about import

2015-09-11 Thread Frank Millman
"Ian Kelly" wrote in message news:calwzidm3khnagtt0ohveo5bhqk1tfejbuuuinw9tnuxrpnr...@mail.gmail.com... On Thu, Sep 10, 2015 at 1:12 AM, Frank Millman wrote: > That makes me wonder if, in my project, I can import all modules inside > 'start.py', and then just use 'import

Re: Question about import

2015-09-11 Thread dieter
"Frank Millman" writes: >... > My project comprises a number of modules, split into packages. Modules > frequently need to access the contents of other modules, in the same > or in a different package. I am getting better at it, but I still > occasionally bump my head against

Question about import

2015-09-10 Thread Frank Millman
Hi all My project comprises a number of modules, split into packages. Modules frequently need to access the contents of other modules, in the same or in a different package. I am getting better at it, but I still occasionally bump my head against circular imports, and have to fiddle around

Re: Question about import

2015-09-10 Thread Ian Kelly
On Thu, Sep 10, 2015 at 1:12 AM, Frank Millman wrote: > That makes me wonder if, in my project, I can import all modules inside > 'start.py', and then just use 'import package_name' inside each module? You can, but for readability and reuse I think it's better to be explicit

Re: Question about import

2015-09-10 Thread Peter Otten
Ian Kelly wrote: > On Thu, Sep 10, 2015 at 1:12 AM, Frank Millman wrote: >> That makes me wonder if, in my project, I can import all modules inside >> 'start.py', and then just use 'import package_name' inside each module? > > You can, but for readability and reuse I think

Re: Question about import

2015-09-10 Thread Ian Kelly
On Thu, Sep 10, 2015 at 8:47 AM, Peter Otten <__pete...@web.de> wrote: > Ian Kelly wrote: >> That surprises me also, but I suspect it's because they're >> subdirectories of the current working directory rather than packages >> found on the sys.path. > > So even the experts cannot keep up with all

Question about import hooks

2013-11-23 Thread Ed Schofield
Hi all, I am the author of the ``future`` package for Python 2/3 compatibility (http://python-future.org). A bug report has recently been posted about its use of import hooks that I don't yet have an answer for, and I am looking for some guidance on how to customize the import mechanism in a

Re: Question about import hooks

2013-11-23 Thread Mark Lawrence
On 23/11/2013 12:23, Ed Schofield wrote: Hi all, I am the author of the ``future`` package for Python 2/3 compatibility (http://python-future.org). A bug report has recently been posted about its use of import hooks that I don't yet have an answer for, and I am looking for some guidance on

Newbie question about import arcgisscripting

2010-11-12 Thread Becky Kern
Hi, I'm a brand new Python 2.7 user, attempting to use it to convert a raster file to an ASCII file. I used ArcGis9.3 to create the raster file. My code begins with the line import arcgisscripting However, Python gives an error message ImportError: DLL load failed: The specified module could

Re: question about import

2008-06-12 Thread Jonathan Vanasco
On Jun 11, 1:45 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Is it cursed upon? Didn't know that. I didn't either. Until I asked some people how to do it, and was admonished for even suggesting the concept. However, __import__ only gives you the topmost module - in your case myapp. ah, i

question about import

2008-06-11 Thread Jonathan Vanasco
I'm a little unclear about import / __import__ I'm exploring dynamically importing modules for a project, and ran into this behavior works as expected: app = __import__( myapp ) appModel = __import__( myapp.model ) but... appname= 'myapp' app = __import__( %s % appname )

Re: question about import

2008-06-11 Thread Diez B. Roggisch
Jonathan Vanasco schrieb: I'm a little unclear about import / __import__ I'm exploring dynamically importing modules for a project, and ran into this behavior works as expected: app = __import__( myapp ) appModel = __import__( myapp.model ) but... appname= 'myapp' app =

Re: Newbie question about import

2008-04-27 Thread Luca
On Sat, Apr 26, 2008 at 4:14 AM, Gabriel Genellina [EMAIL PROTECTED] wrote: The short answer is: don't do that! __init__.py may import any module, but other modules in the package should not import anything from __init__.py The same rule applies to the main module in an application: it can

Newbie question about import

2008-04-25 Thread Luca
Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called mommy.py * a __version__ var defined inside the main __init__.py From the

Re: Newbie question about import

2008-04-25 Thread Larry Bates
Luca wrote: Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called mommy.py * a __version__ var defined inside the main __init__.py

Re: Newbie question about import

2008-04-25 Thread Kay Schluehr
On 25 Apr., 20:03, Luca [EMAIL PROTECTED] wrote: Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called mommy.py * a __version__

Re: Newbie question about import

2008-04-25 Thread Gabriel Genellina
En Fri, 25 Apr 2008 15:03:18 -0300, Luca [EMAIL PROTECTED] escribió: Hi all. I'm trying to do something with python import but isn't working for me. Using python 2,5 I've a program structured like this: * a main module called (for example) mommy with an __init__.py and a file called

Re: Question about import and sys.path

2006-11-29 Thread Rob Wolfe
Frank Millman wrote: One small point. The docs have the following warning - Important: the caller is responsible for closing the file argument, if it was not None, even when an exception is raised. This is best done using a try ... finally statement. I have added this to my code. I

Re: Question about import and sys.path

2006-11-28 Thread Rob Wolfe
Frank Millman wrote: Hi all I am writing a business/accounting application. Once a user has logged in they are presented with a menu. Each menu option has a description and an associated file name and program name. The file name is the name of a .py file (impName) and the program name is

Re: Question about import and sys.path

2006-11-28 Thread Frank Millman
Rob Wolfe wrote: Frank Millman wrote: Hi all However, I want the ability to have duplicate program names stored in different subdirectories. At the time of selecting the menu option I know which company is active, so I know which directory I want to run the program from, but there

Question about import and sys.path

2006-11-27 Thread Frank Millman
Hi all I am writing a business/accounting application. Once a user has logged in they are presented with a menu. Each menu option has a description and an associated file name and program name. The file name is the name of a .py file (impName) and the program name is the name of a class in that

Question about import and namespace

2006-09-01 Thread jdemoor
Hi, I'm new to Python and have the following problem : I have an application started by a main.py file, which does a ' from module_1 import * '. main.py is responsible from the creation of an object which is then used in module_1. What is the best way to make that object visible in the module_1

Re: Question about import and namespace

2006-09-01 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], jdemoor wrote: I have an application started by a main.py file, which does a ' from module_1 import * '. main.py is responsible from the creation of an object which is then used in module_1. What is the best way to make that object visible in the module_1 namespace ?

Re: Question about import and namespace

2006-09-01 Thread Peter Otten
[EMAIL PROTECTED] wrote: I'm new to Python and have the following problem : I have an application started by a main.py file, which does a ' from module_1 import * '. main.py is responsible from the creation of an object which is then used in module_1. What is the best way to make that

Re: Question about import and namespace

2006-09-01 Thread jdemoor
Thanks for the replies. You can do both from module import * import module as these kinds of import are not mutually exclusive. Would this run the code in 'module' twice, or just make the objects in it accessible by several names ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about import and namespace

2006-09-01 Thread Peter Otten
[EMAIL PROTECTED] wrote: Thanks for the replies. You can do both from module import * import module as these kinds of import are not mutually exclusive. Would this run the code in 'module' twice, or just make the objects in it accessible by several names ? The latter. But why don't

Re: Question about import and namespace

2006-09-01 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], jdemoor wrote: from module import * import module as these kinds of import are not mutually exclusive. Would this run the code in 'module' twice, or just make the objects in it accessible by several names ? The code at module level is only executed at first import.

Re: Question about import and namespace

2006-09-01 Thread jdemoor
Ok, thanks again. That was helpful. -- http://mail.python.org/mailman/listinfo/python-list

newbie question about import tools

2006-08-20 Thread pascal . roca
i have just downloas python and trying to import tools module C:\Documents and Settings\totopython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v Type help, copyright, credits or license import tools Traceback (most recent call last): File stdin, line 1, in ? ImportError: No module named tools

Re: newbie question about import tools

2006-08-20 Thread Christoph Haas
On Sunday 20 August 2006 21:39, [EMAIL PROTECTED] wrote: i have just downloas python and trying to import tools module C:\Documents and Settings\totopython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v Type help, copyright, credits or license import tools Traceback (most recent call

Re: newbie question about import tools

2006-08-20 Thread Lawrence Oluyede
[EMAIL PROTECTED] wrote: do i need to download tools.pyc ? Python doesn't have any tools module builtin. So, what tool is? -- Lawrence - http://www.oluyede.org/blog Nothing is more dangerous than an idea if it's the only one you have - E. A. Chartier --