Pex import problems

2014-10-21 Thread Sam Raker
Hi all, I'm trying to use Pex (http://pex.readthedocs.org/en/latest/index.html) to include requests in a little script to ping a server from a machine that doesn't come with pip (or much of anything, really) installed. I'm running into problems outputting a pex file that depends on a local script.

Re: Pex import problems

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 3:36 AM, Sam Raker wrote: >> That's because that isn't the mailing list's name. Sign up here: > >> https://mail.python.org/mailman/listinfo/python-list > >> ChrisA > > Thank you for your help. No probs. Sorry I can't help with your main issue, as I'm not at all familiar wi

Re: Pex import problems

2014-10-21 Thread Sam Raker
On Tuesday, October 21, 2014 12:05:00 PM UTC-4, Chris Angelico wrote: > On Wed, Oct 22, 2014 at 2:34 AM, Sam Raker wrote: > > > (Also: anyone who's planning on chewing me out about formatting: I TRIED > > posting by email to comp.lang.pyt...@googlegroups.com, but it wouldn't let > > me. Sorry f

Re: Pex import problems

2014-10-21 Thread Chris Angelico
On Wed, Oct 22, 2014 at 2:34 AM, Sam Raker wrote: > (Also: anyone who's planning on chewing me out about formatting: I TRIED > posting by email to comp.lang.pyt...@googlegroups.com, but it wouldn't let > me. Sorry for the extra whitespace.) That's because that isn't the mailing list's name. Sig

Pex import problems

2014-10-21 Thread Sam Raker
Hi all, I'm trying to use Pex (http://pex.readthedocs.org/en/latest/index.html) to include requests in a little script to ping a server from a machine that doesn't come with pip (or much of anything, really) installed. I'm running into problems outputting a pex file that depends on a local scrip

Re: import problems.

2012-01-11 Thread Antoon Pardon
On 01/11/2012 03:45 PM, Antoon Pardon wrote: On 01/11/2012 02:57 PM, Peter Otten wrote: Antoon Pardon wrote: I have an import problem I can't figure out. I am using python 2.6.6 on a debian box In one directory (pylib) I have a file misc.py and the file testutil.py. from misc import Rec

Re: import problems.

2012-01-11 Thread Antoon Pardon
On 01/11/2012 02:57 PM, Peter Otten wrote: Antoon Pardon wrote: I have an import problem I can't figure out. I am using python 2.6.6 on a debian box In one directory (pylib) I have a file misc.py and the file testutil.py. from misc import Rec ImportError: cannot import nam

Re: import problems.

2012-01-11 Thread Peter Otten
Antoon Pardon wrote: > I have an import problem I can't figure out. > I am using python 2.6.6 on a debian box > > In one directory (pylib) I have a file misc.py and > the file testutil.py. > from misc import Rec > ImportError: cannot import name Rec > > Why can I import Rec from misc in te

Re: import problems.

2012-01-11 Thread Dave Angel
On 01/11/2012 08:21 AM, Antoon Pardon wrote: I have an import problem I can't figure out. I am using python 2.6.6 on a debian box In one directory (pylib) I have a file misc.py and the file testutil.py. testutil.py -- print "in", __name__ from misc imp

import problems.

2012-01-11 Thread Antoon Pardon
I have an import problem I can't figure out. I am using python 2.6.6 on a debian box In one directory (pylib) I have a file misc.py and the file testutil.py. testutil.py -- print "in", __name__ from misc import Rec -

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-12 Thread Dave Angel
greg wrote: Dave Angel wrote: The point you should get from that link is "Don't do circular imports. Ever." No, I would say the lesson to be learned from this is "don't use the same file as both a main script and an imported module". I would create another file called e.g. 'main.py' that

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-12 Thread greg
Dave Angel wrote: The point you should get from that link is "Don't do circular imports. Ever." No, I would say the lesson to be learned from this is "don't use the same file as both a main script and an imported module". I would create another file called e.g. 'main.py' that simply contain

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-11 Thread Stephen Fairchild
ryles wrote: >> I always thought code in a module was only executed once, >> but doesn't seem to be true. >> >> I'm using Python 2.5. >> >> And this is the example: >> >> == A.py == >> My_List = [] >> >> == B.py == >> from A import * >> My_List.append ( 3 ) >> print 'B', My_List >> import C >> >>

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-11 Thread Dave Angel
(please don't top-post. Put your reply *after* the message you're quoting.) Stef Mientki wrote: thanks very much Stephen, This is the first time I become aware of the difference between script and module !! Starting with the wrong book "Learning Python" second edition, from Lutz and Ascher,

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-11 Thread Stef Mientki
thanks very much Stephen, This is the first time I become aware of the difference between script and module !! Starting with the wrong book "Learning Python" second edition, from Lutz and Ascher, based on Python 2.3" in combination with using Python only from a high level IDE (PyScripter), (ne

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-11 Thread ryles
On Oct 10, 7:36 pm, Stef Mientki wrote: > hello, > > I always thought code in a module was only executed once, > but doesn't seem to be true. > > I'm using Python 2.5. > > And this is the example: > > == A.py == > My_List = [] > > == B.py == > from A import * > My_List.append ( 3 ) > print 'B', My

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-10 Thread Hendrik van Rooyen
On Sunday, 11 October 2009 02:24:34 Stephen Hansen wrote: > It's really better all around for "modules" to be considered like > libraries, that live over There, and aren't normally executed. Then you > have scripts over Here which may just be tiny and import a module and call > that module's "main

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-10 Thread Stephen Hansen
On Sat, Oct 10, 2009 at 4:36 PM, Stef Mientki wrote: > hello, > > I always thought code in a module was only executed once, > but doesn't seem to be true. > This is one of the reasons why that whole big mess of a ton separate scripts that all call each-other and are sometimes imported and sometim

Re: code in a module is executed twice (cyclic import problems) ?

2009-10-10 Thread Benjamin Peterson
Stef Mientki gmail.com> writes: > Why is the B.py executed twice ? Because it's executed once as a script and once as a module. -- http://mail.python.org/mailman/listinfo/python-list

code in a module is executed twice (cyclic import problems) ?

2009-10-10 Thread Stef Mientki
hello, I always thought code in a module was only executed once, but doesn't seem to be true. I'm using Python 2.5. And this is the example: == A.py == My_List = [] == B.py == from A import * My_List.append ( 3 ) print 'B', My_List import C == C.py == from A import * from B import * print 'C

Re: Import Problems

2007-04-27 Thread Robert Kern
Bill Jackson wrote: > Once again, I am having issues with imports... > > Until now, I thought the general guidelines were to rarely use 'from x > import y' syntax, except when you really want to copy names over. No, the guideline is to not use "from x import *" except at the interactive prompt

Re: Import Problems

2007-04-27 Thread Bill Jackson
Bill Jackson wrote the following on 04/27/2007 12:49 PM: > # importtest/test2/__init__.py > from someclass import * > from test2 import * Sorry typo here: # importtest/test2/__init__.py from someclass import * from mytest import * -- http://mail.python.org/mailman/listinfo/python-list

Import Problems

2007-04-27 Thread Bill Jackson
Once again, I am having issues with imports... Until now, I thought the general guidelines were to rarely use 'from x import y' syntax, except when you really want to copy names over. However, I have run into issues by following this guideline. So... 1) What is going wrong in the example below

Re: import problems in packages

2005-09-28 Thread Peter Otten
Stéphane Ninin wrote: > Also sprach Stéphane Ninin : Sollte es denn möglich sein! Dieser alte Heilige hat in seinem Walde noch Nichts davon gehört... that intra-package import takes precedence over absolute import! > Here is the basic structure of the code (I have reduced it first). And nicely

Re: import problems in packages

2005-09-28 Thread Peter Hansen
Stéphane Ninin wrote: > Traceback (most recent call last): > File "main.py", line 8, in ? > main() > File "main.py", line 5, in main > handler = HandlerFactory().makeHandler(command) > File "c:\ROOT\Handlers\HandlerFactory.py", line 6, in HandlerFactory > import Handlers.Default.H

Re: import problems in packages

2005-09-28 Thread St�phane Ninin
Also sprach Stéphane Ninin : > > > ... when I start main.py, I get: > > Traceback (most recent call last): > File "main.py", line 8, in ? > main() > File "main.py", line 5, in main > handler = HandlerFactory().makeHandler(command) > File "c:\ROOT\Handlers\HandlerFactory.py", line

import problems in packages

2005-09-28 Thread St�phane Ninin
Hello all, I have an ImportError problem, which is probably correct, but I do not understand it. And how to fix it... Here is the basic structure of the code (I have reduced it first). ROOT: /main.py /Handlers/__init__.py (empty) /Handlers/Handlers.py /Handlers/HandlerFactory.py

Re: import problems *newbie*

2005-01-17 Thread Steve Holden
running different versions of Python. I found that I solve my import problems by adding one line to .bash_profile, which sets PYTHONPATH to the parent directory of my custom directory tree. Or, on Windows, I add an Environment variable, call it PYTHONPATH, and set it to the necessary directory. The

Re: import problems *newbie*

2005-01-16 Thread Grig Gheorghiu
versions of Python. I found that I solve my import problems by adding one line to .bash_profile, which sets PYTHONPATH to the parent directory of my custom directory tree. Or, on Windows, I add an Environment variable, call it PYTHONPATH, and set it to the necessary directory. The alternative would be

Re: import problems *newbie*

2005-01-16 Thread mike kreiner
Thanks for your help Steve and F. Petitjean. Sorry for taking so long to get back, I was away from my lab for a few days. The path to my directory was not included in the sys.path list. Adding a my.pth file to the site-packages directory fixed the import problem. F. Petitjean, I originally edited

Re: import problems *newbie*

2005-01-14 Thread Steve Holden
F. Petitjean wrote: Le 13 Jan 2005 21:58:36 -0800, mike kreiner a écrit : I am having trouble importing a module I created. I'm running PythonWin on Windows XP if that helps. I saved my module in a folder called my_scripts in the site-packages directory. I edited the python path to include the my_s

Re: import problems *newbie*

2005-01-14 Thread F. Petitjean
Le 13 Jan 2005 21:58:36 -0800, mike kreiner a écrit : > I am having trouble importing a module I created. I'm running PythonWin > on Windows XP if that helps. I saved my module in a folder called > my_scripts in the site-packages directory. I edited the python path to > include the my_scripts folde

import problems *newbie*

2005-01-13 Thread mike kreiner
I am having trouble importing a module I created. I'm running PythonWin on Windows XP if that helps. I saved my module in a folder called my_scripts in the site-packages directory. I edited the python path to include the my_scripts folder (it now reads C:\Python23\Lib;C:\Python23\DLLs;C:\Python23\L