Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread Cameron Simpson
On 09Oct2019 16:50, DL Neil wrote: Another option might be to add a symlink* from the application's directory to wherever you've downloaded and expanded the GitHub .zip archive. I do this. A current project is using Spectra's ds3 Python library. The project itself has a directory for the add

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread DL Neil via Python-list
On 9/10/19 4:34 PM, jf...@ms4.hinet.net wrote: jf...@ms4.hinet.net於 2019年10月8日星期二 UTC+8上午10時45分36秒寫道: For example: from my-dir import test I know it can be solved by renaming, but any alternative? --Jach Maybe another (better?) solution is: import sys sys.path.append(r'my-dir') import test

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread jfong
jf...@ms4.hinet.net於 2019年10月8日星期二 UTC+8上午10時45分36秒寫道: > For example: > from my-dir import test > > I know it can be solved by renaming, but any alternative? > > --Jach Maybe another (better?) solution is: import sys sys.path.append(r'my-dir') import test --Jach -- https://mail.python.org/mail

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread Chris Angelico
On Wed, Oct 9, 2019 at 12:56 PM DL Neil via Python-list wrote: > > On 9/10/19 2:46 PM, Chris Angelico wrote: > > On Wed, Oct 9, 2019 at 12:36 PM DL Neil via Python-list > > wrote: > ... > > > (Or just using pip to install directly from GitHub, although not > > everyone knows that that's possible.

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread DL Neil via Python-list
On 9/10/19 2:46 PM, Chris Angelico wrote: On Wed, Oct 9, 2019 at 12:36 PM DL Neil via Python-list wrote: ... (Or just using pip to install directly from GitHub, although not everyone knows that that's possible.) Come on, you just knew I was going to ask how... -- Regards =dn -- https://mai

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread Chris Angelico
On Wed, Oct 9, 2019 at 12:36 PM DL Neil via Python-list wrote: > > On 9/10/19 2:12 PM, jf...@ms4.hinet.net wrote: > > dieter於 2019年10月8日星期二 UTC+8下午1時33分20秒寫道: > >> jf...@ms4.hinet.net writes: > >>> ... > >>> But most of the download from Github has a directory named '-master' > >>> which caus

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread DL Neil via Python-list
On 9/10/19 2:12 PM, jf...@ms4.hinet.net wrote: dieter於 2019年10月8日星期二 UTC+8下午1時33分20秒寫道: jf...@ms4.hinet.net writes: ... But most of the download from Github has a directory named '-master' which causes a trouble sometimes. Those are likely not meant to be imported directly. Typically, y

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-08 Thread jfong
dieter於 2019年10月8日星期二 UTC+8下午1時33分20秒寫道: > jf...@ms4.hinet.net writes: > > ... > > But most of the download from Github has a directory named '-master' > > which causes a trouble sometimes. > > Those are likely not meant to be imported directly. > > Typically, you have a "setup" step which i

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread dieter
jf...@ms4.hinet.net writes: > ... > But most of the download from Github has a directory named '-master' > which causes a trouble sometimes. Those are likely not meant to be imported directly. Typically, you have a "setup" step which installs (in some way) a "distribution". This step usually

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread jfong
DL Neil於 2019年10月8日星期二 UTC+8上午11時02分20秒寫道: > On 8/10/19 3:45 PM, jf...@ms4.hinet.net wrote: > > For example: > > from my-dir import test > > > > I know it can be solved by renaming, but any alternative? > > > The manual is your friend: > - import > - importlib > > (the latter allows modules to

Re: How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread DL Neil via Python-list
On 8/10/19 3:45 PM, jf...@ms4.hinet.net wrote: For example: from my-dir import test I know it can be solved by renaming, but any alternative? The manual is your friend: - import - importlib (the latter allows modules to be identified by strings) However, Pythons has naming rules. If you try

How to handle '-' in the 'from' part in a "from import" statement?

2019-10-07 Thread jfong
For example: from my-dir import test I know it can be solved by renaming, but any alternative? --Jach -- https://mail.python.org/mailman/listinfo/python-list

Re: from ./.. import

2019-10-04 Thread Terry Reedy
Level I just cannot figure out why they using the ``from ./.. import'' to import modules. These are 'relative imports'. Read the doc for import statements. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: from ./.. import

2019-10-04 Thread Jon Ribbens via Python-list
import Color > from .level import Level > > I just cannot figure out why they using the ``from ./.. import'' to > import modules. Why wouldn't they be? That's how you import things from the current/parent package. -- https://mail.python.org/mailman/listinfo/python-list

from ./.. import

2019-10-04 Thread Hongyi Zhao
using the ``from ./.. import'' to import modules. Any hints? -- https://mail.python.org/mailman/listinfo/python-list

Re: What meaning is 'from . import'

2016-01-07 Thread Chris Angelico
On Fri, Jan 8, 2016 at 3:50 AM, Robert wrote: > Hi, > > I see the following code. After searching around, I still don't know the > meaning of '.'. Could you tell me that ? Thanks, > > > > > > from . import _hmmc > from .utils import normalize

What meaning is 'from . import'

2016-01-07 Thread Robert
Hi, I see the following code. After searching around, I still don't know the meaning of '.'. Could you tell me that ? Thanks, from . import _hmmc from .utils import normalize -- https://mail.python.org/mailman/listinfo/python-list

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 10:22 AM, Jack Diederich wrote: > On Thu, Jun 17, 2010 at 12:58 PM, Stephen Hansen >> It explicitly states later its entirely OK to import classes. It never >> says anything else directly, except in the example given, it shows you >> importing a constant. So, its giving implicit approval

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
Jack Diederich wrote: You want to import a name that is itself a namespace; preferably a module or package and sometimes a class. Importing constants can lead to trouble. ex/ from settings import DEBUG if DEBUG: log('debug is on!') The value of the flag gets fetched at import time. If code i

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Jack Diederich
#x27; >>> on this, except that its okay to use "from ... import ..." to pull in >>> classes and (implicitly) constants, and despite how the rules say 'one >>> module per line' its OK to pull in more then one name -from- a module at >>> once. >

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
Stephen Hansen wrote: On 6/17/10 10:01 AM, Ethan Furman wrote: Stephen Hansen wrote: On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: Now, this is all IMHO: the style guide does not define any 'guidelines' on this, except that its okay to use "from ... import ..." to

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 10:01 AM, Ethan Furman wrote: > Stephen Hansen wrote: >> On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: >> >> Now, this is all IMHO: the style guide does not define any 'guidelines' >> on this, except that its okay to use "from ... import

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Ethan Furman
Stephen Hansen wrote: On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: Now, this is all IMHO: the style guide does not define any 'guidelines' on this, except that its okay to use "from ... import ..." to pull in classes and (implicitly) constants, and despite how the rules

Re: Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread Stephen Hansen
On 6/17/10 9:12 AM, pyt...@bdurham.com wrote: > Are there any efficiency or style guidelines regarding the choice > of "import " vs. "from import , ..."? There are no legitimate efficiency issues. In theory, module.blah is slightly slower then blah, but that "sli

Efficiency/style issues of import vs. from import , ...

2010-06-17 Thread python
Are there any efficiency or style guidelines regarding the choice of "import " vs. "from import , ..."? If one only needs to import a few names from a module, are there specific benefits to explictly importing these names? My understanding is that both forms of the import

Re: PyDev : undefined variable from import

2010-04-26 Thread Fabio Zadrozny
On Mon, Apr 26, 2010 at 12:08 PM, Wanderer wrote: > Since the last Java update, I get the error, "undefined variable from > import" in Pydev in the Eclipse editor. I can still run the program in > Eclipse. If I add a blank line and save the program, the error goes > away,

PyDev : undefined variable from import

2010-04-26 Thread Wanderer
Since the last Java update, I get the error, "undefined variable from import" in Pydev in the Eclipse editor. I can still run the program in Eclipse. If I add a blank line and save the program, the error goes away, but that screws up the revision with SVN. Has anyone else seen this or

Re: from import and __init__.py

2010-03-26 Thread Gregory Ewing
egbert wrote: Yes, you are right. And I can reach everything with modules['some_package'] or variants thereof. Although note that the usual way to get it would be to simply do import some_package -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: from import and __init__.py

2010-03-25 Thread egbert
On Thu, Mar 25, 2010 at 12:43:13PM -0400, Terry Reedy wrote: > On 3/25/2010 6:16 AM, egbert wrote: > >When I do 'from some_package import some_module' > >the __init__.py of some_package will be run. > >However, there will not be anything like a package-module, > >and the effects of __init__.py see

Re: from import and __init__.py

2010-03-25 Thread Terry Reedy
On 3/25/2010 6:16 AM, egbert wrote: When I do 'from some_package import some_module' the __init__.py of some_package will be run. However, there will not be anything like a package-module, and the effects of __init__.py seem all to be lost. Is that true ? No. If you do from sys import modules

Re: from import and __init__.py

2010-03-25 Thread Steve Holden
egbert wrote: > When I do 'from some_package import some_module' > the __init__.py of some_package will be run. > However, there will not be anything like a package-module, > and the effects of __init__.py seem all to be lost. Is that true ? > Or can I still do something useful with __init__.py ?

from import and __init__.py

2010-03-25 Thread egbert
When I do 'from some_package import some_module' the __init__.py of some_package will be run. However, there will not be anything like a package-module, and the effects of __init__.py seem all to be lost. Is that true ? Or can I still do something useful with __init__.py ? e -- Egbert Bouwman

Re: reloading the module imported as 'from ... import ...'

2009-08-10 Thread William
What about using the reimport library? http://code.google.com/p/reimport/ Cheers, William From: AlF To: python-list@python.org Sent: Monday, August 10, 2009 1:48:31 AM Subject: Re: reloading the module imported as 'from ... import ...' Steven D&#x

Re: reloading the module imported as 'from ... import ...'

2009-08-10 Thread Piet van Oostrum
>>>>> Steven D'Aprano (SD) wrote: >SD> On Sun, 09 Aug 2009 22:48:31 -0700, AlF wrote: >>> Steven D'Aprano wrote: >>>> On Sun, 09 Aug 2009 20:43:41 -0700, AlF wrote: >>>> >>>>> Hi, >>>&

Re: reloading the module imported as 'from ... import ...'

2009-08-09 Thread Steven D'Aprano
On Sun, 09 Aug 2009 22:48:31 -0700, AlF wrote: > Steven D'Aprano wrote: >> On Sun, 09 Aug 2009 20:43:41 -0700, AlF wrote: >> >>> Hi, >>> >>> what is the best way to reload the module imported using 'from ... >>> import ...' >&

Re: reloading the module imported as 'from ... import ...'

2009-08-09 Thread AlF
Steven D'Aprano wrote: On Sun, 09 Aug 2009 20:43:41 -0700, AlF wrote: Hi, what is the best way to reload the module imported using 'from ... import ...' Have you tried "from ... import ..." again? I have not because of an assumption that "import" imp

Re: reloading the module imported as 'from ... import ...'

2009-08-09 Thread Steven D'Aprano
On Sun, 09 Aug 2009 20:43:41 -0700, AlF wrote: > Hi, > > what is the best way to reload the module imported using 'from ... > import ...' Have you tried "from ... import ..." again? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

reloading the module imported as 'from ... import ...'

2009-08-09 Thread AlF
Hi, what is the best way to reload the module imported using 'from ... import ...' Is following a way to do so? >>> from email.charset import Charset >>> reload(email.charset) Traceback (most recent call last): File "", line 1, in NameError: name &#x

Re: unexpected from/import statement behaviour

2008-08-27 Thread nisp
On Aug 27, 3:35 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > nisp wrote: > > Thanks first of all ! I read the interesting Diez's link but something > > still remains to me unclear, on the other hand it's clear the my > > problem is concentrated there and on symbols. > > Read it again. If you have t

Re: unexpected from/import statement behaviour

2008-08-27 Thread alex23
On Aug 27, 5:42 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > alex23 schrieb: > > > > > nisp <[EMAIL PROTECTED]> wrote: > >> I've always been convinced of the equivalence of the two ways of using > >> the import statement but it's clear I'm wrong :-( > > > Python 2.5.2 (r252:60911, Jul 31 200

Re: unexpected from/import statement behaviour

2008-08-27 Thread Peter Otten
nisp wrote: > Thanks first of all ! I read the interesting Diez's link but something > still remains to me unclear, on the other hand it's clear the my > problem is concentrated there and on symbols. Read it again. If you have two modules module1.py from sys import stderr module2.py from module

Re: unexpected from/import statement behaviour

2008-08-27 Thread nisp
;> > from sys import std err > > >> > > > >> > print >> stderr, "Some text" > > >> > While in my module I use > > >> > import sys > > >> > . sys.stderr ... sys.stdout > > >> > Well, as long as I do n

Re: unexpected from/import statement behaviour

2008-08-27 Thread Diez B. Roggisch
>> > While in my module I use >> >> > import sys >> >> > . sys.stderr ... sys.stdout >> >> > Well, as long as I do not change in the external module those from/ >> > import statements to just >> >> > import sys >&

Re: unexpected from/import statement behaviour

2008-08-27 Thread nisp
file object > > method write. > > The external module outputs to stderr this way: > > > from sys import std err > > > > > > print >> stderr, "Some text" > > > While in my module I use > > > import sys > > > ..

Re: unexpected from/import statement behaviour

2008-08-27 Thread Peter Otten
y: > > from sys import std err > > > > print >> stderr, "Some text" > > While in my module I use > > import sys > > . sys.stderr ... sys.stdout > > Well, as long as I do not change in the external module those from/ > import sta

Re: unexpected from/import statement behaviour

2008-08-27 Thread Diez B. Roggisch
alex23 schrieb: nisp <[EMAIL PROTECTED]> wrote: I've always been convinced of the equivalence of the two ways of using the import statement but it's clear I'm wrong :-( Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "cre

Re: unexpected from/import statement behaviour

2008-08-27 Thread alex23
nisp <[EMAIL PROTECTED]> wrote: > I've always been convinced of the equivalence of the two ways of using > the import statement but it's clear I'm wrong :-( Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "licens

Re: unexpected from/import statement behaviour

2008-08-27 Thread Diez B. Roggisch
print >> stderr, "Some text" While in my module I use import sys . sys.stderr ... sys.stdout Well, as long as I do not change in the external module those from/ import statements to just import sys print >> sys.stderr, "Some text"

unexpected from/import statement behaviour

2008-08-27 Thread nisp
t; stderr, "Some text" While in my module I use import sys . sys.stderr ... sys.stdout Well, as long as I do not change in the external module those from/ import statements to just import sys print >> sys.stderr, "Some text" I'm not a

Re: module name available in 'from ... import ...' statement

2007-04-30 Thread kwatch
-- regards, kwatch "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 30 Apr 2007 20:19:54 -0300,kwatch<[EMAIL PROTECTED]> escribió: > > > Could you teach me the condition of module name which is available > > in 'from ... import ...&

Re: [Q] module name available in 'from ... import ...' statement

2007-04-30 Thread Gabriel Genellina
En Mon, 30 Apr 2007 20:19:54 -0300, kwatch <[EMAIL PROTECTED]> escribió: > Could you teach me the condition of module name which is available > in 'from ... import ...' statement? > > The goal what I want to do is to create a module by 'new' module &

Re: [Q] module name available in 'from ... import ...' statement

2007-04-30 Thread Carsten Haese
On Mon, 2007-04-30 at 16:19 -0700, kwatch wrote: > [...] > The goal what I want to do is to create a module by 'new' module > and specify that module name in 'from ...' statement. > > > # create a module > import new > foo = new.module('foo'

[Q] module name available in 'from ... import ...' statement

2007-04-30 Thread kwatch
What is the condition of module name which is available in 'from .. import ..' statement ? import os print os.path # from posixpath import sep # (no errors) from os.path import sep# (no errors, wow!

Re: from... import...

2007-02-02 Thread Ben Finney
[EMAIL PROTECTED] writes: > what's the from ... import keyword use for? > for example - from contenttype import getContentType > > import os > import sys > import getopt > import types > import re > import pprint > import logging > from contenttype impo

Re: from... import...

2007-02-02 Thread Paddy
On Feb 3, 4:12 am, [EMAIL PROTECTED] wrote: > what's the from ... import keyword use for? > for example - from contenttype import getContentType > > import os > import sys > import getopt > import types > import re > import pprint > import logging > from co

Re: from... import...

2007-02-02 Thread Stargaming
[EMAIL PROTECTED] schrieb: > what's the from ... import keyword use for? > for example - from contenttype import getContentType > > import os > import sys > import getopt > import types > import re > import pprint > import logging > from contenttype import ge

from... import...

2007-02-02 Thread fatwallet961
what's the from ... import keyword use for? for example - from contenttype import getContentType import os import sys import getopt import types import re import pprint import logging from contenttype import getContentType In Java what kind of statement is similar this? thanks --

RE: Illegal instruction or undefined symbol from import

2006-07-05 Thread Kerry, Richard
ssage- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nick Maclaren Sent: 05 July 2006 11:32 To: python-list@python.org Subject: Re: Illegal instruction or undefined symbol from import In article <[EMAIL PROTECTED]>, Mathias Waack <[EMAIL PROTECTED]> writes: |>

Re: Illegal instruction or undefined symbol from import

2006-07-05 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Mathias Waack <[EMAIL PROTECTED]> writes: |> |> > There's |> > a lot of somewhat obscure mathematical stuff that got into the standard |> > C lib. How often do you need Bessel functions? |> |> Maybe each day. What is a Bessel function?;) Some people use them all

Re: Illegal instruction or undefined symbol from import

2006-07-05 Thread Mathias Waack
Richard Brodie wrote: > "Mathias Waack" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> BTW, does anybody know why the c-lib offers both log and log1p? > > So you can get a sensible answer computing log(1 + 10 ^ -30). Ok, that make sense to me. > There's > a lot of somewha

Re: Illegal instruction or undefined symbol from import

2006-07-05 Thread Richard Brodie
"Mathias Waack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > BTW, does anybody know why the c-lib offers both log and log1p? So you can get a sensible answer computing log(1 + 10 ^ -30). There's a lot of somewhat obscure mathematical stuff that got into the standard C lib. How

Re: Illegal instruction or undefined symbol from import

2006-07-05 Thread Mathias Waack
Continuing my monologe;) Mathias Waack wrote: > I've embedded python into a legacy application. It works - most of the > time. In some special situations the app crashes executing the "import > random". There are two different situations: > > 1. the sources compiled with gcc 4.1.2 crash with ille

Illegal instruction or undefined symbol from import

2006-07-04 Thread Mathias Waack
Hi, I've embedded python into a legacy application. It works - most of the time. In some special situations the app crashes executing the "import random". There are two different situations: 1. the sources compiled with gcc 4.1.2 crash with illegal instruction error: (running my application)