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