fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Importing Fabric Library Locally


From: Todd DeLuca
Subject: Re: [Fab-user] Importing Fabric Library Locally
Date: Mon, 26 Aug 2013 10:23:55 -0400

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 <address@hidden> 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 <address@hidden> 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 <address@hidden> 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 address@hidden http://lathama.net ~
>>
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/fab-user
>
>
>
> --
> Jeff Forcier
> Unix sysadmin; Python/Ruby engineer
> http://bitprophet.org



--
~ Andrew "lathama" Latham address@hidden http://lathama.net ~

_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user



--
Todd DeLuca
Scientific Programmer
http://todddeluca.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]