On Thu, 25 Apr 2019, dieter wrote:
The means that "test_act_de.py" has not extended "sys.path"
appropriately.
Dieter,
That's what I thought.
When Python starts a script ("gui/test_act_de.py" in your case), it
automatically extends "sys.path" with the folder containing the script
("gui" in y
Rich Shepard writes:
>> bustrac/
>>README.rst
>>bustrac.py*
>>controller/
>>classes/
> model.py
>>scripts/
>>gui/
> test_act_de.py
>
> test_act_de.py tries to import model.py from the classes package:
> from classes import model as m
>
> Running in bustrac
On Wed, 24 Apr 2019, Rich Shepard wrote:
The current project's directory structure is:
I changed package names so there are no duplicate names for packages and
modules.
bustrac/
README.rst
bustrac.py*
controller/
classes/
model.py
scripts/
gui/
test_act
On Wed, 24 Apr 2019, Rich Shepard wrote:
If I correctly understand the process, in bustrac.py I'll add import
sys.path sys.path.append(controller, model, scripts, views)
Never mind. I've installed virtualenv and will work within it.
Regards,
Rich
--
https://mail.python.org/mailman/listinfo/p
On Wed, 24 Apr 2019, dieter wrote:
With a "virtualenv", there is usually no need to tweak "sys.path" --
you simply install everything your project needs into the "virtualenv".
Dieter,
Okay. I just upgraded pip to 19.1 for python3 and virtualenv to version
16.5.0. Now I'll learn how to use it
On Wed, 24 Apr 2019, dieter wrote:
"sys.path" tweaks are typically employed with a "central" Python
installation, to have it look at non-standard places for module/packages
under specific circumstances.
Almost all python packages installed here are built using the
SlackBuilds.org scripts (I ru
Rich Shepard writes:
> On Tue, 23 Apr 2019, dieter wrote:
> ...
> One project is for my own use and I understand now that a virtualenv with
> its own sys.path appendices would work.
Those are two separate approaches:
With a "virtualenv", there is usually no need to tweak "sys.path" --
you simply
On Tue, 23 Apr 2019, dieter wrote:
I use "virtualenv" (for "VIRTUAL ENVironmet") to separate
projects.
Dieter,
I know about virtualenv and tried using them. Found conflicting information
and didn't know if I really needed them. I'll re-learn how to activate and
use them.
One project is for m
Rich Shepard writes:
> On Thu, 18 Apr 2019, dieter wrote:
> ...
>> 2. extend "sys.path" in your scripts to contain the "bustrac" folder
>> (before you try to import infrastructure modules/packages)
>
> I read the docs for sys and site and have insufficient experience with them
> to know how best t
On Thu, 18 Apr 2019, dieter wrote:
I see two options for you:
1. put your scripts directly into "bustrac" (rather than a subdirectory)
There are too many files; the directory is very cluttered.
2. extend "sys.path" in your scripts to contain the "bustrac" folder
(before you try to import in
On Thu, 18 Apr 2019, dieter wrote:
Python knows about 2 kinds of "regular" imports: absolute ones and
relative ones. "Absolute" imports are guided by "sys.path" -- in the
simple case, a sequence of folders containing modules and/or pacakges.
Relative imports are guided in a similar way by the cu
On Wed, 17 Apr 2019, Sayth Renshaw wrote:
Apologies I don't know the answer but went looking. This guide should
answer the question. Didn't know it was so difficult to be honest.
https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html#example-directory-structure
Then there
Rich Shepard writes:
> What is the proper syntax to import the model class in the model/
> subdirectory into a tkinter view module, e.g., activities.py? The syntax,
> 'import model as m' fails because it is not in the same subdirectory as the
> importing module.
>
> The program directory tree is:
On Thursday, 18 April 2019 06:59:43 UTC+10, Rich Shepard wrote:
> What is the proper syntax to import the model class in the model/
> subdirectory into a tkinter view module, e.g., activities.py? The syntax,
> 'import model as m' fails because it is not in the same subdirectory as the
> importing
On 1/31/12 3:08 PM, gujax wrote:
Hi,
I am confused on this quite bad!!
If I have this typed in interactive python:
import numpy
def dummy():
y=numpy.arange(1,2,0.1)
return y
and then
s = dummy()
s
array[1. , 1.1, 1.2]
it works.
But if I have a module called example.p
Holzwarth, Dominique (Berne Branch) wrote:
> Hi all
>
> Lets assume I have the following structure of directories and python
> modules:
>
> Root-dir
> |_dir1
> |_ script1.py
> |_dir2
> |_ script2.py
> |_sudir2
> |_ script3.py
>
> Is it possible to import script1 into script2 and scri
On Mon, Feb 2, 2009 at 3:11 PM, Chris Rebert wrote:
> On Mon, Feb 2, 2009 at 1:29 AM, S.Selvam Siva
> wrote:
> > Hi all,
> > I have a small query,
> > Consider there is a task A which i want to perform.
> >
> > To perform it ,i have two option.
> > 1)Writing a small piece of code(approx. 50 line
On Mon, Feb 2, 2009 at 1:29 AM, S.Selvam Siva wrote:
> Hi all,
> I have a small query,
> Consider there is a task A which i want to perform.
>
> To perform it ,i have two option.
> 1)Writing a small piece of code(approx. 50 lines) as efficient as possible.
> 2)import a suitable module to perform t
Sean Davis a écrit :
What is the "best practice" for importing an arbitrary module given
that the name is stored in a variable? The context is a simple web
application with URL dispatching to a module and function. I know of
__import__(), the imp module, and exec. For each of these, is there a
On Sat, 30 Aug 2008 11:02:03 -0700 (PDT), Sean Davis wrote:
> What is the "best practice" for importing an arbitrary module given
> that the name is stored in a variable? The context is a simple web
> application with URL dispatching to a module and function. I know of
> __import__(), the imp mod
On Jun 18, 10:18 am, Duncan Booth <[EMAIL PROTECTED]>
wrote:
> [EMAIL PROTECTED] wrote:
> > I downloaded BeautifulSoup.py from
> >http://www.crummy.com/software/BeautifulSoup/and being a n00bie, I
> > just placed it in my Windows c:\python25\lib\ file. When I type
> > "import beautifulsoup" from th
[EMAIL PROTECTED] wrote:
> I downloaded BeautifulSoup.py from
> http://www.crummy.com/software/BeautifulSoup/ and being a n00bie, I
> just placed it in my Windows c:\python25\lib\ file. When I type
> "import beautifulsoup" from the interactive prompt it works like a
> charm. This seemed too easy i
Ben Finney escribió:
> Matias Surdi <[EMAIL PROTECTED]> writes:
>
>> Suppose I've a module named "urllib" and from it I need to import
>> the urllib module from the python standart library.
>
> What you want is the "absolute import" behaviour, described in PEP 328
> http://www.python.org/peps/pep
Matias Surdi <[EMAIL PROTECTED]> writes:
> Suppose I've a module named "urllib" and from it I need to import
> the urllib module from the python standart library.
What you want is the "absolute import" behaviour, described in PEP 328
http://www.python.org/peps/pep-0328.html> and implemented in
Py
Matias Surdi a écrit :
> Hi,
>
> 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 f
Most problems like this are caused by trying to access the attributes
of the module before that module is fully executed, and thus before
they are defined.
For example, if you have A.py:
import B
data = "TEST"
And B.py:
import A
print A.data
Now, if you run A,py, it will import B before
[EMAIL PROTECTED] wrote:
> On 2007-09-27, Steve Holden <[EMAIL PROTECTED]> wrote:
>
>> Self-evidently you are *not* creating the variables you think you are in
>> the variablePage module. Have you tried an interactive test? Try this at
>> the interpreter prompt:
>>
> import variablePage
>
On 2007-09-27, Steve Holden <[EMAIL PROTECTED]> wrote:
> Self-evidently you are *not* creating the variables you think you are in
> the variablePage module. Have you tried an interactive test? Try this at
> the interpreter prompt:
>
> >>> import variablePage
> >>> dir(variablePage)
>
> and you wil
[EMAIL PROTECTED] wrote:
> I'm stymied by what should be a simple Python task: accessing the value of
> a variable assigned in one module from within a second module. I wonder if
> someone here can help clarify my thinking. I've re-read Chapter 16 (Module
> Basics) in Lutz and Ascher's "Learning
Nathan Harmston wrote:
> I ve got a single module which I m using to contain a lot of
> dictionaries, constants, general information, which are used by
> various other modules. However I can't seem to access them:
>
> in data.py
> _SEQTYPE_DNA = 0
> _SEQTYPE_RNA = 1
> _SEQTYPE_PROT = 2
> _seqTy
Nathan Harmston wrote:
> Hi All,
>
> I ve got a single module which I m using to contain a lot of
> dictionaries, constants, general information, which are used by
> various other modules. However I can't seem to access them:
>
> in data.py
> _SEQTYPE_DNA = 0
> _SEQTYPE_RNA = 1
> _SEQTYPE_PROT = 2
31 matches
Mail list logo