[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] problem with importing a SIP module
From:       Qin Shen <jeanshen () tippett ! com>
Date:       2010-10-29 17:40:24
Message-ID: 4CCB0708.1020005 () tippett ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks so much, Phil! It works now. I never would have thought about
the reason why it didn't work.

Thanks a lot for looking into it!

-Jean

Phil Thompson wrote:
> On Tue, 26 Oct 2010 12:46:28 -0700, Qin Shen <jeanshen@tippett.com> wrote:
>   
>> Hi Phil,
>>
>> It looks like the problem I'm having is caused by the namespace.
>> After removing the namespace, %Import works just fine. But We do
>> need to keep the namespace in our project. What do I need to do
>> to make it work?
>>     
>
> It is working...
>
> SIP implements a C++ namespace as a single Python class - in this case
> A.SG.
>
> It does not implement it as a separate class in each module. In other
> words, in this case, it does not implement it as A.SG and B.SG.
>
> When the B module is imported the contents of the SG namespace that it
> implements are added to the SG class in the A module.
>
> Your testB.py will work if you replace...
>
> from B import *
>
> ...to...
>
> import B
> from A import SG
>
> (Actually it doesn't matter what the order of these two lines are.)
>
> I admit that all this isn't very obvious, and I might not do it this way
> if I was doing it today.
>
> Phil
>
>   


[Attachment #5 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks so much, Phil! It works now. I never would have thought about<br>
the reason why it didn't work.<br>
<br>
Thanks a lot for looking into it!<br>
<br>
-Jean<br>
<br>
Phil Thompson wrote:
<blockquote cite="mid:169e9e83d178f5920b54c3d1b035d68d@localhost"
 type="cite">
  <pre wrap="">On Tue, 26 Oct 2010 12:46:28 -0700, Qin Shen <a \
class="moz-txt-link-rfc2396E" \
href="mailto:jeanshen@tippett.com">&lt;jeanshen@tippett.com&gt;</a> wrote:  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi Phil,

It looks like the problem I'm having is caused by the namespace.
After removing the namespace, %Import works just fine. But We do
need to keep the namespace in our project. What do I need to do
to make it work?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
It is working...

SIP implements a C++ namespace as a single Python class - in this case
A.SG.

It does not implement it as a separate class in each module. In other
words, in this case, it does not implement it as A.SG and B.SG.

When the B module is imported the contents of the SG namespace that it
implements are added to the SG class in the A module.

Your testB.py will work if you replace...

from B import *

...to...

import B
from A import SG

(Actually it doesn't matter what the order of these two lines are.)

I admit that all this isn't very obvious, and I might not do it this way
if I was doing it today.

Phil

  </pre>
</blockquote>
<br>
</body>
</html>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic