On 2019-05-18 16:15:34 -0700, Rich Shepard wrote:
> My apologies to all who patiently tried to get me to see what I kept
> missing.
I've certainly made similar mistakes in the past (and probably will in
the future).
And I didn't see it when I read your mail the first time. But then I
read Piet's
On Sun, 19 May 2019, Peter J. Holzer wrote:
This won't help much if your directory named "business-tracker" (see
above).
Peter, et al.:
Yep. User error. The directory is actually 'business_tracker' and I used the
application name, 'bustrac', instead when I set PYTHONPATH. Discovered this
a bi
On 2019-05-18 09:43:34 -0700, Rich Shepard wrote:
> The project layout, briefly, is:
>
> ~/development/business-tracker/
> classes/
> gui/
>
> All subdirectories contain a __init__.py file to identify them as packages.
> 'classes/' contains model.py; '
Rich Shepard writes:
>
> $ python3
> Python 3.7.3 (default, Mar 26 2019, 06:40:28) [GCC 5.5.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
import sys
sys.path
> ['', '/home/rshepard/development/bustrac', '/usr/lib/python37.zip',
> '/usr/lib/python3.
On Sat, 18 May 2019, Peter J. Holzer wrote:
"" is in sys.path, so "classes" and classes.model are found.
Now lets go to a different subdirectory:
This doesn't work, since there is no classes/model.py in "", only in "..".
But if I add a PYTHONPATH, it works again:
Peter,
The project layout,
On 2019-05-18 05:45:23 -0700, Rich Shepard wrote:
> On Sat, 18 May 2019, dieter wrote:
> > > > sys.path
> ['', '/home/rshepard/development/bustrac', '/usr/lib/python37.zip',
> '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload',
> '/usr/lib/python3.7/site-packages']
>
> All directories are pres
On Sat, 18 May 2019, dieter wrote:
Test this by looking at "sys.path" instead:
import sys
sys.path
It is "sys.path" which actually controls the import machinery.
Dieter,
Thank you. I missed this when researching PYTHONPATH. Here's what I get:
sys.path
['', '/home/rshepard/development/bus
Rich Shepard writes:
>> The project directory contains subdirectories, including gui/ (with the
>> tkinter views) and classes/ with the SQLAlchemy model.py.
> ...
> Second, in ~/.bash_profile I added two lines, the first is the project's
> root directory:
>
> PYTHONPATH=$HOME/development/bustrac
>
On Thu, 16 May 2019, Rich Shepard wrote:
The project directory contains subdirectories, including gui/ (with the
tkinter views) and classes/ with the SQLAlchemy model.py.
Getting closer, but still missing a piece of the solution.
First, I added __init__.py to each module subdirectory to speci
On Fri, 17 May 2019, Inada Naoki wrote:
This is slightly off topic (not relating to your problem), but please
don't think "Python 3 doesn't require __init__.py for packages". It is
common misunderstanding.
Inada,
Actually, your response is on topic and probably the reason I have the
import pr
2019年5月17日(金) 9:25 Rich Shepard :
>
> My understanding is that Python3 does not require subdirectories to have an
> __init__.py file, only Python2 does. If that's not correct I'll add the
> blank file.
>
This is slightly off topic (not relating to your problem), but please don't
think "Python 3 do
Rich Shepard writes:
> I'm developing a Python3 application using Python3-3.7.3 and
> virtualenv-16.5.0 on a Slackware-14.2 host.
>
> The project directory contains subdirectories, including gui/ (with the
> tkinter views) and classes/ with the SQLAlchemy model.py.
>
> Within the gui/ directory as
On Fri, 17 May 2019, duncan smith wrote:
You could make the subdirectories Python packages. Google (or better
DuckDuckGo) is your friend.
Duncan,
My understanding is that Python3 does not require subdirectories to have an
__init__.py file, only Python2 does. If that's not correct I'll add the
On 16/05/2019 22:50, Rich Shepard wrote:
> I'm developing a Python3 application using Python3-3.7.3 and
> virtualenv-16.5.0 on a Slackware-14.2 host.
>
> The project directory contains subdirectories, including gui/ (with the
> tkinter views) and classes/ with the SQLAlchemy model.py.
>
> Within
I'm developing a Python3 application using Python3-3.7.3 and
virtualenv-16.5.0 on a Slackware-14.2 host.
The project directory contains subdirectories, including gui/ (with the
tkinter views) and classes/ with the SQLAlchemy model.py.
Within the gui/ directory as the cwd testing the code for a v
On 05/12/2018 02:30, Oscar Benjamin wrote:
> Hi all,
>
> I'm looking to import a module given a string representing the path to
> the .py file defining the module. For example given this setup
>
> mkdir -p a/b/c
> touch a/__init__.py
> touch a/b/__init__.py
> touch a/b/c/__init__.py
> touch a/b/c
On Wed, 5 Dec 2018 at 07:57, Peter Otten <__pete...@web.de> wrote:
>
> Oscar Benjamin wrote:
> >
> > I'm looking to import a module given a string representing the path to
> > the .py file defining the module.
>
> I am not aware of a clean way. I have used
>
> def guess_modulename(filename):
>
Oscar Benjamin wrote:
> Hi all,
>
> I'm looking to import a module given a string representing the path to
> the .py file defining the module. For example given this setup
>
> mkdir -p a/b/c
> touch a/__init__.py
> touch a/b/__init__.py
> touch a/b/c/__init__.py
> touch a/b/c/stuff.py
>
> I hav
Hi all,
I'm looking to import a module given a string representing the path to
the .py file defining the module. For example given this setup
mkdir -p a/b/c
touch a/__init__.py
touch a/b/__init__.py
touch a/b/c/__init__.py
touch a/b/c/stuff.py
I have a module a.b.c.stuff which is defined in the
Hello,
here is my project hierarchy:
myproject
|
|- django-project-name
| |- django-project-name
| | |-urls.py
| | |-views.py
| |- manage.py
|- my-package
Is my projet tree correct? Shouldn't I put my-package into my
django-project-name folder?
Because I am facing some questionning about
Error:
ImportError: No module named google.protobuf
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
I need to use the google protobuf for my task.
1. Yum install protobuf worked for default python 2.7.5 in my VM. But I need to
test with Python 2.7.14.
I installed protobuf using yum on "/usr/lib64/python2.7/site-packages"
I added the above path to PYTHONPATH and its not recognizing when
Steven D'Aprano writes:
> On Fri, 26 Feb 2016 10:38 am, Ben Finney wrote:
>
> > Gregory Ewing writes:
> >
> >> sohcahto...@gmail.com wrote:
> >> > Now, I've noticed people talking about importing os.path. Is there any
> >> > reason to use "import os.path" rather than "import os"? Both of them
On Fri, Feb 26, 2016 at 2:56 PM, Ian Kelly wrote:
> On Thu, Feb 25, 2016 at 5:40 PM, Steven D'Aprano wrote:
>> If you take "Special cases are not special enough" seriously, you will not
>> use `import os.path` since os is not a package:
>>
>> py> os.__package__
>> ''
>>
>> and os.path is not part
On Thu, Feb 25, 2016 at 5:40 PM, Steven D'Aprano wrote:
> If you take "Special cases are not special enough" seriously, you will not
> use `import os.path` since os is not a package:
>
> py> os.__package__
> ''
>
> and os.path is not part of os, it's just a publicly exposed attribute which
> merel
On Fri, 26 Feb 2016 10:38 am, Ben Finney wrote:
> Gregory Ewing writes:
>
>> sohcahto...@gmail.com wrote:
>> > Now, I've noticed people talking about importing os.path. Is there any
>> > reason to use "import os.path" rather than "import os"? Both of them
>> > will still put the "os" module in
Gregory Ewing writes:
> sohcahto...@gmail.com wrote:
> > Now, I've noticed people talking about importing os.path. Is there any
> > reason to use "import os.path" rather than "import os"? Both of them will
> > still put the "os" module into the global namespace.
>
> In the case of os.path it do
sohcahto...@gmail.com wrote:
Now, I've noticed people talking about importing os.path. Is there any
reason to use "import os.path" rather than "import os"? Both of them will
still put the "os" module into the global namespace.
In the case of os.path it doesn't matter, because the
os module im
On Wednesday, February 24, 2016 at 5:07:57 PM UTC-8, Dan Stromberg wrote:
> Could people please compare and contrast the two ways of doing imports
> in the Subject line?
>
> I've long favored the latter, but I'm working in a code base that
> prefers the former.
>
> Is it fair to say that the form
On 02/25/2016 08:20 AM, Dan Stromberg wrote:
My intuition is telling me that "module.data; module.data.mutate()"
would be easier to monkey patch in a way that all modules will see.
Is that fair to say?
It is fair to say that if you need to monkey-patch a module, you should
import the module.
On 02/24/2016 07:39 PM, Steven D'Aprano wrote:
(2) import module
(a) Mutation is no different from (1)(a) above. No change.
(b) Rebinding `module.data = []` affects the imported module, and therefore
everything that relies on it.
More accurate: and therefore everything that has not al
t; in the Subject line?
>>
>> from module import data; print(data)
>>
>> import module; print(module.data)
>
>>> Is it fair to say that the former increases the surface area of your
>>> shared (sometimes mutable) state?
>>
>> No, I can't
On Wed, Feb 24, 2016 at 7:39 PM, Steven D'Aprano
wrote:
> On Thursday 25 February 2016 12:07, Dan Stromberg wrote:
>
>> Could people please compare and contrast the two ways of doing imports
>> in the Subject line?
>
> from module import data; print(data)
>
&g
On Thursday 25 February 2016 12:07, Dan Stromberg wrote:
> Could people please compare and contrast the two ways of doing imports
> in the Subject line?
from module import data; print(data)
import module; print(module.data)
> I've long favored the latter, but I'm working
h, join as joinpath
and then using "joinpath(a, b)".
Is it fair to say that the former increases the surface area of your
shared (sometimes mutable) state?
It can go the other way. Consider:
import module
module.data = 1
versus:
from module import data
data = 1
The former
Could people please compare and contrast the two ways of doing imports
in the Subject line?
I've long favored the latter, but I'm working in a code base that
prefers the former.
Is it fair to say that the former increases the surface area of your
shared (sometimes mutable) state?
It's clear that
Now I get this error:
Traceback (most recent call last):
File "C:\raspberrypi\recipe-578839-1.py", line 1, in
import pyttsx
File
"C:\Users\loek\AppData\Local\Programs\Python\Python35\lib\site-packages\pyttsx\__init__.py",
line 18, in
from engine import Engine
ImportError: No module
On 11/16/2015 12:45 PM, input/ldompel...@casema.nl wrote:
In reply to "MRAB" who wrote the following:
Have you installed pyttsx?
No, I did not.
Where can I find pyttsx to install ?
Let pip find it (its on pypi).
On a command line, enter 'pip install pyttsx'
--
Terry Jan Reedy
--
https://mail
On 2015-11-16 17:45, input/ldompel...@casema.nl wrote:
In reply to "MRAB" who wrote the following:
Have you installed pyttsx?
No, I did not.
Where can I find pyttsx to install ?
The first place to look is PyPI. It's here:
https://pypi.python.org/pypi/pyttsx
You might want to look at the link
In reply to "MRAB" who wrote the following:
Have you installed pyttsx?
No, I did not.
Where can I find pyttsx to install ?
Thanks
-
> On 2015-11-16 17:12, input/ldompel...@casema.nl wrote:
> > When I try to run this module in Win
On 2015-11-16 17:12, input/ldompel...@casema.nl wrote:
When I try to run this module in Windows IDLE I get this message:
How can I solve this problem.
Thanks
Traceback (most recent call last):
File "C:\raspberrypi\recipe-578839-1.py", line 1, in
import pyttsx
ImportError: No module nam
When I try to run this module in Windows IDLE I get this message:
How can I solve this problem.
Thanks
Traceback (most recent call last):
File "C:\raspberrypi\recipe-578839-1.py", line 1, in
import pyttsx
ImportError: No module named 'pyttsx'
This is what I found on the internet:
syed khalid wrote:
> I am trying to do a "import shogun" in my python script. I can invoke
> shogun with a command line with no problem. But I cannot with a python
> import statement.
>
>>invoking python from a command line...
>
> Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfac
On Sun, Jul 28, 2013 at 12:15 AM, syed khalid wrote:
> Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfaces/cmdline_static$
> shogun | more
This implies that you have something called 'shogun', without an
extension, in your $PATH. Where is the actual script? You may need to
install it by a qu
I am trying to do a "import shogun" in my python script. I can invoke shogun
with a command line with no problem. But I cannot with a python import
statement.
>invoking python from a command line...
Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfaces/cmdline_static$ shogun
| mo
On 2013-06-29, Steven D'Aprano wrote:
> On Sat, 29 Jun 2013 19:13:47 +, Martin Schöön wrote:
>
>> $PYTHONPATH points at both the code and the test directories.
>>
>> When I run blablabla_test.py it fails to import blablabla.py
>
> What error message do you get?
>
>
>> I have messed around f
On Sat, 29 Jun 2013 19:13:47 +, Martin Schöön wrote:
> $PYTHONPATH points at both the code and the test directories.
>
> When I run blablabla_test.py it fails to import blablabla.py
What error message do you get?
> I have messed around for oven an hour and get nowhere. I have done
> unitt
In article ,
Martin Schöön wrote:
> I know the answer to this must be trivial but I am stuck...
>
> I am starting on a not too complex Python project. Right now the
> project file structure contains three subdirectories and two
> files with Python code:
>
> code
>blablabla.py
> test
>b
I know the answer to this must be trivial but I am stuck...
I am starting on a not too complex Python project. Right now the
project file structure contains three subdirectories and two
files with Python code:
code
blablabla.py
test
blablabla_test.py
doc
(empty for now)
blablabla_test.p
On Dec 12, 2012 9:47 AM, "Yong Hu" wrote:
>
> I have a few scripts whose file names start with numbers. For example,
01_step1.py, 02_step2.py
>
> I tried to import them in another script by "import 01_step1" or "from
01_step1 import *". Both failed, saying "SyntaxError: invalid syntax"
>
> Is ther
Yong Hu wrote:
> I have a few scripts whose file names start with numbers. For example,
> 01_step1.py, 02_step2.py
>
> I tried to import them in another script by "import 01_step1" or "from
> 01_step1 import *". Both failed, saying "SyntaxError: invalid syntax"
>
> Is there anyway to import thos
On 12/12/2012 12:42 PM, Yong Hu wrote:
> I have a few scripts whose file names start with numbers. For example,
> 01_step1.py, 02_step2.py
>
> I tried to import them in another script by "import 01_step1" or "from
> 01_step1 import *". Both failed, saying "SyntaxError: invalid syntax"
>
> Is ther
I have a few scripts whose file names start with numbers. For example,
01_step1.py, 02_step2.py
I tried to import them in another script by "import 01_step1" or "from 01_step1
import *". Both failed, saying "SyntaxError: invalid syntax"
Is there anyway to import those files? The file name must
goldtech wrote:
> I tried install a Python - would the word be "package"? - on Ubuntu
> 10.10. Could you tell me how to fix? I would be grateful, is it a path
> problem? Thanks. Lee
If you are talking about http://paul.giannaros.org/pykhtml/ , this package
requires kde3 while you are /probably/
On Fri, 03 Dec 2010 12:27:04 -0800, goldtech wrote:
> I tried install a Python - would the word be "package"? - on Ubuntu
> 10.10. Could you tell me how to fix? I would be grateful, is it a path
> problem? Thanks. Lee
That looks to me like either a missing dependency, or a bug in the
package.
I
I tried install a Python - would the word be "package"? - on Ubuntu
10.10. Could you tell me how to fix? I would be grateful, is it a path
problem? Thanks. Lee
gi...@giga1:~/Desktop/pykhtml-0.2$ sudo python setup.py install
[sudo] password for giga1:
running install
running build
running build_py
On 05/19/2010 09:40 AM, Harikrishnan R wrote:
Hi ,
I have a file a.py contains
from one.two import abc
is there any way to find out "one.two" the import Path of abc. ?
I don't want one.two.abc . Any function or attribute which directly
Hi ,
I have a file a.py contains
from one.two import abc
is there any way to find out "one.two" the import Path of abc. ?
I don't want one.two.abc . Any function or attribute which directly
give one.two ?
-Regards
--
Harikrishan R
http:/
Robert Kern wrote:
On 2009-10-31 19:16 PM, Peng Yu wrote:
On Sat, Oct 31, 2009 at 7:02 PM, Robert Kern
wrote:
On 2009-10-31 18:51 PM, Peng Yu wrote:
If I have both the directory 'module' and the file 'module.py' in a
directory in $PYTHONPATH, python will import
On 2009-10-31 19:16 PM, Peng Yu wrote:
On Sat, Oct 31, 2009 at 7:02 PM, Robert Kern wrote:
On 2009-10-31 18:51 PM, Peng Yu wrote:
If I have both the directory 'module' and the file 'module.py' in a
directory in $PYTHONPATH, python will import 'module' rather t
On Sat, Oct 31, 2009 at 7:02 PM, Robert Kern wrote:
> On 2009-10-31 18:51 PM, Peng Yu wrote:
>>
>> If I have both the directory 'module' and the file 'module.py' in a
>> directory in $PYTHONPATH, python will import 'module' rather than
>> &
On 2009-10-31 18:51 PM, Peng Yu wrote:
If I have both the directory 'module' and the file 'module.py' in a
directory in $PYTHONPATH, python will import 'module' rather than
'module.py'. I'm wondering what is the design rationale of setting
higher
If I have both the directory 'module' and the file 'module.py' in a
directory in $PYTHONPATH, python will import 'module' rather than
'module.py'. I'm wondering what is the design rationale of setting
higher priorities to directories. Is
On Thursday 16 July 2009 08:38:57 Peter Fodrek wrote:
> On Thursday 16 July 2009 07:38:23 Carl Banks wrote:
> > On Jul 15, 10:16 pm, Peter Fodrek wrote:
> > > On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:
> sys.path.insert(0,'/usr/local/lib/heekscnc/')
I was mentioned that this adds
On Thursday 16 July 2009 07:38:23 Carl Banks wrote:
> On Jul 15, 10:16 pm, Peter Fodrek wrote:
> > On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:
> > > Peter Fodrek wrote:
> >
> > ..
> >
> > > What does
> > >
> > > import nc
> > > print nc.__file__
> >
> > python
> > Python 2.6 (r2
On Jul 15, 10:16 pm, Peter Fodrek wrote:
> On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:
>
> > Peter Fodrek wrote:
> ..
> > What does
>
> > import nc
> > print nc.__file__
>
> python
> Python 2.6 (r26:66714, Feb 3 2009, 20:49:49)
> [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on
On Thursday 16 July 2009 02:18:52 Carl Banks wrote:
> On Jul 15, 6:12 am, Peter Fodrek wrote:
> That's a tricky one, indeed.
>
> Here's my guess: test.py is a symlink to a file in another directory.
It is not true guess
ls -la test.py
-rw-r--r-- 1 peto users 1990 2009-07-15 14:19 test.py
But m
On Wednesday 15 July 2009 17:41:54 Diez B. Roggisch wrote:
> Peter Fodrek wrote:
..
> What does
>
> import nc
> print nc.__file__
python
Python 2.6 (r26:66714, Feb 3 2009, 20:49:49)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for mo
On Jul 15, 6:12 am, Peter Fodrek wrote:
> Dear conference!
>
> I have test Why python based script for HeeksCNC post-processing does not
> work... And I've got unbelievable behavior When importing module module
> manually it works, but same opertaion from script does not
> work as seen
>
> /opt
Peter Fodrek wrote:
> Dear conference!
>
> I have test Why python based script for HeeksCNC post-processing does not
> work... And I've got unbelievable behavior When importing module module
> manually it works, but same opertaion from script does not
> work as seen
>
> /opt/HeeksCAD8/HeeksCN
On Wed, Jul 15, 2009 at 8:12 AM, Peter Fodrek wrote:
>
> Would anyone be helpful for me to get more information about this problem
> because pydb does not show anything usable for me,please?
What is the directory structure for the HeeksCNC module? Although I'm
no expert, I suspect it looks someth
Dear conference!
I have test Why python based script for HeeksCNC post-processing does not
work... And I've got unbelievable behavior When importing module module
manually it works, but same opertaion from script does not
work as seen
/opt/HeeksCAD8/HeeksCNC> python
Python 2.6 (r26:66714, Fe
John Machin wrote:
On Jun 30, 11:45 am, bvdp <[EMAIL PROTECTED]> wrote:
John Machin wrote:
Good questions. Short answer ... probably 'cause I've not thought the
problem though completely :)
> You are updating with *everything* in the 'more' module, not just the
> functions. This includes s
On Jun 30, 11:45 am, bvdp <[EMAIL PROTECTED]> wrote:
> John Machin wrote:
>
>
>
> Good questions. Short answer ... probably 'cause I've not thought the
> problem though completely :)
>
> > You are updating with *everything* in the 'more' module, not just the
> > functions. This includes such thi
John Machin wrote:
Good questions. Short answer ... probably 'cause I've not thought the
problem though completely :)
> You are updating with *everything* in the 'more' module, not just the
> functions. This includes such things as __name__, __doc__, __file__.
> Could have interesting side-e
On Jun 30, 9:52 am, bvdp <[EMAIL PROTECTED]> wrote:
> Terry Reedy wrote:
>
> >
>
>
>
> >
> > Do you mean something like this?
>
>
>
> > >>> math.__dict__.update(string.__dict__)
> > >>> dir(math)
> > ['Formatter', 'Template', '_TemplateMetaclass', '__builtins__',
>
>
>
> I think t
Terry Reedy wrote:
>
>
> Do you mean something like this?
> >>> math.__dict__.update(string.__dict__)
> >>> dir(math)
> ['Formatter', 'Template', '_TemplateMetaclass', '__builtins__',
I think this is working First off, 2 module files:
funcs.py
def func1():
print "I'm func1
Terry Reedy wrote:
bvdp wrote:
Is it possible to do this from a function: import a module and append
the defs in that module to an existing module/namesapce.
So, in my code I have something like:
# main code
import mods
def loadmore(n):
import_module(n, mods)
# end of main
this
bvdp wrote:
Is it possible to do this from a function: import a module and append
the defs in that module to an existing module/namesapce.
So, in my code I have something like:
# main code
import mods
def loadmore(n):
import_module(n, mods)
# end of main
this will permit the add
Le Sunday 29 June 2008 21:08:36 bvdp, vous avez écrit :
> Is it possible to do this from a function: import a module and append
> the defs in that module to an existing module/namesapce.
>
> So, in my code I have something like:
>
> # main code
> import mods
>
> def loadmore(n):
> import_module
Is it possible to do this from a function: import a module and append
the defs in that module to an existing module/namesapce.
So, in my code I have something like:
# main code
import mods
def loadmore(n):
import_module(n, mods)
# end of main
this will permit the addition of the th
[EMAIL PROTECTED] wrote:
> follow the dive into python
> -
import sys
sys.path
sys.path.append('E
\achieve\book\diveintopython-pdfzh-cn-5.4b\diveintopythonzh-cn-5.4b\py')
> --
follow the dive into python
-
>>> import sys
>>> sys.path
>>> sys.path.append('E:\achieve\book\diveintopython-pdfzh-cn-5.4b\diveintopythonzh-cn-5.4b\py')
-
I append the fi
>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?
Try this:
*from stdl
Steve wrote:
> This is an interesting question. It almost looks like a case of
> event-driven programming, where main is the plug-in and abc is the
> framework.
> http://eventdrivenpgm.sourceforge.net/
>
> So how about something like this:
>
> ## abc.py
>
> #-
Jim wrote:
> John Machin wrote:
> > Jim wrote:
> > > Hi,
> > >
> > > I have created an import module. And would like to access a function
> > > from the main script, e.g.,
> > >
> > > file abc.py:
> > >
This is an interesting question. It almost looks like a case of
event-driven programming, where main is the plug-in and abc is the
framework.
http://eventdrivenpgm.sourceforge.net/
So how about something like this:
## abc.py
#
John Machin wrote:
> Jim wrote:
> > Hi,
> >
> > I have created an import module. And would like to access a function
> > from the main script, e.g.,
> >
> > file abc.py:
> > ###
> > def a():
> > m()
> >
Jim wrote:
> Application abc is designed as a complete module. The user is to
> script their own functions to work with application abc.
so use execfile() with a prepared namespace:
namespace = { ...stuff to export to the module ... }
execfile("directory/module.py", namespace)
--
Jim wrote:
> Hi,
>
> I have created an import module. And would like to access a function
> from the main script, e.g.,
>
> file abc.py:
> ###
> def a():
> m()
> return None
>
>
> file main.py:
> ###
Bjoern Schliessmann wrote:
> Jim wrote:
>
> > I have created an import module. And would like to access a
> > function from the main script, e.g.,
>
> May I ask why? This style violates "normal" module philosophy.
>
> Regards,
>
>
> Björn
>
&g
Jim wrote:
> I have created an import module. And would like to access a
> function from the main script, e.g.,
May I ask why? This style violates "normal" module philosophy.
Regards,
Björn
--
BOFH excuse #307:
emissions from GSM-phones
--
http://mail.python.org/mailman
Jim wrote:
> I have created an import module. And would like to access a function
> from the main script, e.g.,
>
> file abc.py:
> ###
> def a():
> m()
> return None
>
>
> file main.py:
> #
Jim wrote:
> I have created an import module. And would like to access a function
> from the main script, e.g.,
>
> file abc.py:
> ###
> def a():
> m()
> return None
>
>
> file main.py:
> #
Jim wrote:
> Hi,
>
> I have created an import module. And would like to access a function
> from the main script, e.g.,
>
> file abc.py:
> ###
> def a():
> m()
> return None
>
>
> file main.py:
> ###
Hi,
I have created an import module. And would like to access a function
from the main script, e.g.,
file abc.py:
###
def a():
m()
return None
file main.py:
#
from abc import *
def m():
print 'something'
retu
"Martin v. Löwis" <[EMAIL PROTECTED]> writes:
> Ben Finney schrieb:
> > Question: I have Python modules named without '.py' as the extension,
> > and I'd like to be able to import them. How can I do that?
>
> I recommend to use imp.load_module.
I've tried this; as Patrick Maupin alludes to, it c
Ben Finney schrieb:
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
I recommend to use imp.load_module.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
Hello Ben,
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
http://docs.python.org/lib/module-imp.html (hint: load_source :)
HTH,
Miki
http://pythonwise.blogspot.com/
--
http://mail.python.org/mailman/listinfo/p
"Patrick Maupin" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > Question: I have Python modules named without '.py' as the extension,
> > and I'd like to be able to import them. How can I do that?
>
> This is a piece of cake in Python.
>
> >>> from types import ModuleType
> >>> x = ModuleTy
1 - 100 of 126 matches
Mail list logo