You can try prepending your package directories to sys.path and I think
they will be found first.  Though the right way to use packages that are
different from the system-wide ones is probably to use a virtualenv.



On Tue, Aug 27, 2013 at 10:40 PM, Andrew Latham <lath...@gmail.com> wrote:

> Ok, back to the drawing board. The imports of paramiko and pycrypto
> were also defaulting to the system versions.  I will do this another
> way.
>
> Just in case anyone cares, I am trying to make a user-space drop in to
> manage some servers in a very restricted environment.  It is just a
> hobby project at the moment.
>
>
> On Tue, Aug 27, 2013 at 9:53 PM, Andrew Latham <lath...@gmail.com> wrote:
> > Ok, finally set down to get some hacking done..  The example by Todd
> > shows the fabric version installed on the system and not the version
> > in the git pull.  Back to square one...
> >
> > On Tue, Aug 27, 2013 at 11:38 AM, Andrew Latham <lath...@gmail.com>
> wrote:
> >> Thanks guys, I think I have a handle on it. Will report back on user
> space
> >> fabric usage...
> >>
> >> On Aug 26, 2013 11:12 AM, "Jeff Forcier" <j...@bitprophet.org> wrote:
> >>>
> >>> Yup, the version module isn't auto-imported into the top level, so
> >>> doing 'from fabric.version import get_version' is probably the "best"
> >>> way to do this. As Todd showed, 'import fabric.version' and then
> >>> referencing things in that module like get_version or __version__,
> >>> would also work.
> >>>
> >>> On Mon, Aug 26, 2013 at 7:47 AM, Todd DeLuca <todddel...@gmail.com>
> wrote:
> >>> > Or it could be that you are not importing the "fabric.version"
> module,
> >>> > just
> >>> > the "fabric" package.
> >>> >
> >>> >
> >>> > On Mon, Aug 26, 2013 at 10:23 AM, Todd DeLuca <todddel...@gmail.com>
> >>> > wrote:
> >>> >>
> >>> >> This works for me:
> >>> >>
> >>> >> $ git clone https://github.com/fabric/fabric
> >>> >> $ python -c 'import sys; sys.path.append("fabric"); import
> >>> >> fabric.version;
> >>> >> print fabric.version.__version__'
> >>> >> 1.6.1
> >>> >>
> >>> >> I'm not sure how you have your code laid out, but try appending
> >>> >> "static/fabric" to sys.path instead of "static/fabric/fabric".
> >>> >>
> >>> >> Regards,
> >>> >> Todd
> >>> >>
> >>> >>
> >>> >>
> >>> >> On Sun, Aug 25, 2013 at 3:17 PM, Andrew Latham <lath...@gmail.com>
> >>> >> wrote:
> >>> >>>
> >>> >>> Jeff, sorry I made some assumptions.
> >>> >>>
> >>> >>> Here is what I am doing
> >>> >>>
> >>> >>> test.py >>>
> >>> >>> #!/usr/bin/env python
> >>> >>>
> >>> >>> import sys
> >>> >>> sys.path.append('static/pycrypto/lib/Crypto')
> >>> >>> sys.path.append('static/paramiko/paramiko')
> >>> >>> sys.path.append('static/fabric/fabric')
> >>> >>>
> >>> >>> import Crypto
> >>> >>> import paramiko
> >>> >>> import fabric
> >>> >>>
> >>> >>> print "Pycrypto Version: " + str(Crypto.version_info)
> >>> >>> print "Paramiko Version: " + str(paramiko.__version__)
> >>> >>> print "Fabric Version: "+ fabric.version
> >>> >>> <<< EOF
> >>> >>>
> >>> >>> here is what I get
> >>> >>> example >>>
> >>> >>> python test.py
> >>> >>> Pycrypto Version: (2, 6, 0, 'final', 0)
> >>> >>> Paramiko Version: 1.9.0
> >>> >>> Traceback (most recent call last):
> >>> >>>   File "test.py", line 15, in <module>
> >>> >>>     print "Fabric Version: "+ fabric.version
> >>> >>> AttributeError: 'module' object has no attribute 'version'
> >>> >>> <<< EOF
> >>> >>>
> >>> >>> I have messed around and decided that it would be better to ask the
> >>> >>> list.  I was able to import the get_version() directly.
> >>> >>>
> >>> >>>
> >>> >>> On Sun, Aug 25, 2013 at 3:02 PM, Jeff Forcier <j...@bitprophet.org
> >
> >>> >>> wrote:
> >>> >>> > Not even an actual traceback, or the code that actually involves
> >>> >>> > Fabric itself? Give us something to work with here :(
> >>> >>> >
> >>> >>> > On Sun, Aug 25, 2013 at 6:15 AM, Andrew Latham <
> lath...@gmail.com>
> >>> >>> > wrote:
> >>> >>> >> All....
> >>> >>> >>
> >>> >>> >> I am attempting to load pycrypto, paramiko, and fabric from a
> local
> >>> >>> >> directory called static.
> >>> >>> >>
> >>> >>> >> I have a project as follows
> >>> >>> >>
> >>> >>> >> project/project.py
> >>> >>> >> project/static/pycrypto
> >>> >>> >> project/static/paramiko
> >>> >>> >> project/static/fabric
> >>> >>> >>
> >>> >>> >> #!/usr/bin/env python
> >>> >>> >> import sys, re, logging
> >>> >>> >> sys.path.append('static/pycrypto/lib/Crypto')
> >>> >>> >> sys.path.append('static/paramiko/paramiko')
> >>> >>> >> import Crypto
> >>> >>> >> import paramiko
> >>> >>> >>
> >>> >>> >> I have pycrypto and paramiko importing correctly and printing
> their
> >>> >>> >> version as a test.
> >>> >>> >>
> >>> >>> >> When I attempt to do the same with fabric it does not work.  I
> can
> >>> >>> >> specify a file or function to load and use it. Importing the
> api.py
> >>> >>> >> fails.  I doubt I am the first to hit this.
> >>> >>> >>
> >>> >>> >>
> >>> >>> >> --
> >>> >>> >> ~ Andrew "lathama" Latham lath...@gmail.com http://lathama.net~
> >>> >>> >>
> >>> >>> >> _______________________________________________
> >>> >>> >> Fab-user mailing list
> >>> >>> >> Fab-user@nongnu.org
> >>> >>> >> https://lists.nongnu.org/mailman/listinfo/fab-user
> >>> >>> >
> >>> >>> >
> >>> >>> >
> >>> >>> > --
> >>> >>> > Jeff Forcier
> >>> >>> > Unix sysadmin; Python/Ruby engineer
> >>> >>> > http://bitprophet.org
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>> --
> >>> >>> ~ Andrew "lathama" Latham lath...@gmail.com http://lathama.net ~
> >>> >>>
> >>> >>> _______________________________________________
> >>> >>> Fab-user mailing list
> >>> >>> Fab-user@nongnu.org
> >>> >>> https://lists.nongnu.org/mailman/listinfo/fab-user
> >>> >>
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> Todd DeLuca
> >>> >> Scientific Programmer
> >>> >> http://todddeluca.com
> >>> >>
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Todd DeLuca
> >>> > Scientific Programmer
> >>> > http://todddeluca.com
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > Fab-user mailing list
> >>> > Fab-user@nongnu.org
> >>> > https://lists.nongnu.org/mailman/listinfo/fab-user
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Jeff Forcier
> >>> Unix sysadmin; Python/Ruby engineer
> >>> http://bitprophet.org
> >
> >
> >
> > --
> > ~ Andrew "lathama" Latham lath...@gmail.com http://lathama.net ~
>
>
>
> --
> ~ Andrew "lathama" Latham lath...@gmail.com http://lathama.net ~
>
> _______________________________________________
> Fab-user mailing list
> Fab-user@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Todd DeLuca
Scientific Programmer
http://todddeluca.com
_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to