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
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
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
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
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
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
>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
"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
Ben Finney wrote:
> Howdy all,
>
> 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?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with no extension. This allows other program
Ben Finney wrote:
> Howdy all,
>
> 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 = ModuleType('myModName')
>>> data = open('myfilename').
"John Machin" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > "John Machin" <[EMAIL PROTECTED]> writes:
> > > If it can [modify sys.path], it can copy the MUT to some temp
> > > directory, adding .py to the end of the name of the new file,
> > > and put the temp directory in sys.path can'
On Tue, 2006-08-08 at 11:06 +1000, Ben Finney wrote:
> Howdy all,
>
> 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?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with n
Ben Finney wrote:
> "John Machin" <[EMAIL PROTECTED]> writes:
>
> > Ben Finney wrote:
> > > Now that I've got it written as a Python module, I'd like to write
> > > unit tests for that module, which of course will need to import
> > > the program module to test it. The unit test can explicitly add
"John Machin" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > Now that I've got it written as a Python module, I'd like to write
> > unit tests for that module, which of course will need to import
> > the program module to test it. The unit test can explicitly add
> > the directory where the p
Ben Finney wrote:
> Howdy all,
>
> 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?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with no extension. This allows other progra
[EMAIL PROTECTED] wrote:
> I'm trying to import a module at runtime using variables to specify
> which module, and which functions to execute. for example:
>
> mStr = "sys"
> fStr = "exit"
>
> # load mod
> mod = __import__(mStr)
> # call function
> mod.fStr()
getattr(mod, fStr)()
--
Giovanni Ba
Hi,
if you want to import module dynamically, you can use __import__ ..
always remember modules are objects ..
mStr="sys"
mod=__import__(mStr)
# Now u can use mod.version .. but cant specify the attribute using
other variable, like u did
mod.version
should read it
http://diveintopython.org/funct
47 matches
Mail list logo