I cannot get bzrlib to import

Asked by EdB

Hi everyone and thanks in advance.

I've been trying to develop a GUI front end for Bazaar. I installed Bazaar 2.x stable, and then Python 2.6. I can't get any of it to work, because I can't even import bzrlib. I've set the PYTHONPATH to include c:\program files (x86)\Bazaar\lib\library.zip, and I can go into Python and get the list of modules and bzrlib, PyQt4 and a few others show up. But when I do import bzrlib I get this:

>>> import bzrlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
zipimport.ZipImportError: can't find module 'bzrlib'

I've read through the documentation many times and tried everything I can think of, including manually appending the path to the lib to sys,.path, unzipping library.zip and adding a path to the destination folder, etc. Nothing works.

Any help I could get would be very much appreciated. I've been using Bazaar and love it, and want to make it even easier to use with a front end for my team.

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
John A Meinel
Solved:
Last query:
Last reply:
Revision history for this message
Best John A Meinel (jameinel) said :
#1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

EdB wrote:
> Question #93763 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/93763
>
> Description changed to:
> Hi everyone and thanks in advance.
>
> I've been trying to develop a GUI front end for Bazaar. I installed
> Bazaar 2.x stable, and then Python 2.6. I can't get any of it to work,
> because I can't even import bzrlib. I've set the PYTHONPATH to include
> c:\program files (x86)\Bazaar\lib\library.lib, and I can go into Python
> and get the list of modules and bzrlib, PyQt4 and a few others show up.
> But when I do import bzrlib I get this:
>
>>>> import bzrlib
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> zipimport.ZipImportError: can't find module 'bzrlib'
>
> I've read through the documentation many times and tried everything I
> can think of, including manually appending the path to the lib to
> sys,.path, unzipping library.zip and adding a path to the destination
> folder, etc. Nothing works.
>
> Any help I could get would be very much appreciated. I've been using
> Bazaar and love it, and want to make it even easier to use with a front
> end for my team.
>

If you want to import bzrlib in your own application, then you probably
want the python installers and not the standalone installer.
(Specifically, you want bzr-2.*-py2.x.exe, not bzr-2.*-setup.exe.)

I would assume there *is* a way to get the library.zip into your path,
but it really isn't designed to be imported by a different python
executable. (Much less if you are running python2.6, and setup.exe was
built with python 2.5, etc.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkslSdIACgkQJdeBCYSNAAPqewCfbLXw4I5y9g2evkgvxxyIBRDa
vcUAmgI+FR2G1fdO3MlNG8Yl1PPF6aQn
=Q2vv
-----END PGP SIGNATURE-----

Revision history for this message
EdB (ed-marsfire) said :
#2

Thanks John A Meinel, that solved my question.

Revision history for this message
EdB (ed-marsfire) said :
#3

Thank you thank you thank you!!!
:-)

Revision history for this message
EdB (ed-marsfire) said :
#4

I've now developed a C++ class that interfaces with Bazaar using the Python installers. I can run this and do adds, commits, etc. from my C++ class and it works! The question I have now is, are you folks on the Bazaar team interested in having a copy at some point? I plan to develop the following:

1) C++ Windows DLL that allows C and C++ applications to call Bazaar functions. (Which could easily be ported to Mac, Unix, etc.)
2) dot-net wrapper for DLL in part 1 that will allow dot-net applications such as C# and VB.NET to call Bazaar functions.

I am asking now because I will develop the code more nicely (meaning formatting, comments, etc.) if it's going to be given out as public domain. Also I would write up a how-to document with specific steps.

If the Bazaar team is interested someone let me know. I would be happy to give you my sources as a payback for all the Bazaar gives to me.

Revision history for this message
Martin Pool (mbp) said :
#5

2009/12/17 EdB <email address hidden>:
> Question #93763 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/93763
>
> EdB posted a new comment:
> I've now developed a C++ class that interfaces with Bazaar using the
> Python installers.  I can run this and do adds, commits, etc. from my
> C++ class and it works!  The question I have now is, are you folks on
> the Bazaar team interested in having a copy at some point?  I plan to
> develop the following:
>
> 1) C++ Windows DLL that allows C and C++ applications to call Bazaar functions.  (Which could easily be ported to Mac, Unix, etc.)
> 2) dot-net wrapper for DLL in part 1 that will allow dot-net applications such as C# and VB.NET to call Bazaar functions.
>
> I am asking now because I will develop the code more nicely (meaning
> formatting, comments, etc.) if it's going to be given out as public
> domain.  Also I would write up a how-to document with specific steps.
>
> If the Bazaar team is interested someone let me know.  I would be happy
> to give you my sources as a payback for all the Bazaar gives to me.

That would be great. Can I suggest you make a new project on
Launchpad, push up your source, then send an announcement of what it
does now and where it's going to the bazaar list? It doesn't need to
be perfect to be announced.

--
Martin <http://launchpad.net/~mbp/>