Am Montag, 2. März 2015 21:38:12 UTC+1 schrieb Jaleks:
>
>
>
> Am Montag, 2. März 2015 20:54:20 UTC+1 schrieb Adrian Klaver:
>>
>> On 03/02/2015 10:53 AM, Jaleks wrote: 
>> > 
>> > 
>> > Am Montag, 2. März 2015 19:26:03 UTC+1 schrieb Adrian Klaver: 
>> > 
>> >     On 03/02/2015 09:07 AM, Jaleks wrote: 
>> >      > 
>> >      > 
>> >      > Am Montag, 2. März 2015 17:59:27 UTC+1 schrieb Adrian Klaver: 
>> >      > 
>> >      >     On 03/02/2015 08:19 AM, [email protected] 
>> >     <javascript:> wrote: 
>> >      >      > Hi all, 
>> >      >      > 
>> >      >      > somehow I do not get the auto-completion of Spyder (2.3.1 
>> >     out of 
>> >      >      > current Debian Sid) working for GTK usage. 
>> >      >      > Following code was taken (and modified) from the PyGtk 
>> >     tutorial: 
>> >      >      > 
>> >      > 
>> >      >      > 
>> >      >      > which also made no difference (even after restarting 
>> Spyder) 
>> >      >      > The code is in either case working as expected, so that 
>> >     should 
>> >      >     not be 
>> >      >      > the problem. 
>> >      >      > 
>> >      >      > If anyone has an idea how to fix this I'd be quite happy. 
>> >      > 
>> >      >     Do you have auto-completion working for anything? 
>> >      > 
>> >      > 
>> >      > 
>> >      > 
>> >      > Auto-completion and showing of documentation works fine for 
>> other 
>> >      > modules (os, sys, matplotlib), including self written ones. 
>> >      > 
>> >      >     Do you have Rope installed on your machine? 
>> >      > 
>> >      > 
>> >      > Spyder's list of optional dependencies says "rope >=0.9.2 : 
>> 0.10.2 
>> >      > (OK)", also all other optional dependencies (except of sympy) 
>> are 
>> >      > installed and listed as OK. 
>> > 
>> >     Tried it here and saw the same thing. With some digging I think I 
>> know 
>> >     the reason. PyGTK is just a wrapper around the GTK library, which I 
>> >     believe is written in C. So when you are trying to find information 
>> >     on a 
>> >     function it does not show anything because there are no doc strings 
>> in 
>> >     the C function and the Python wrapper does not generate any either. 
>> It 
>> >     is easier to see if you do the import in IPython and then do 
>> >     dialog.show? 
>> > 
>> > 
>> > Indeed, if I do 
>> > | 
>> > fromgi.repository importGtk 
>> > dialog 
>> > 
>> =Gtk.MessageDialog(None,0,Gtk.MessageType.ERROR,Gtk.ButtonsType.CLOSE,"unformated
>>  
>>
>> > message") 
>> > | 
>>
>> If I am following correctly the above is using  PyGObject not PyGtk. 
>>
>> > 
>> > in a fresh (Spyder's integrated) IPython, I get auto-completion for 
>> > 'dialog.' and also (sometimes) documentation when opening the first 
>> > bracket of a function. Where that sometimes means, that I can not 
>> > pinpoint it, when it works and when not. But what is reproducable is, 
>> > that typing "Gtk.AboutDialogClass(" results in following Spyder error 
>> > (in its internal console). 
>> > 
>> > | 
>> > Traceback(most recent call last): 
>> > 
>> File"/usr/lib/python2.7/dist-packages/spyderlib/plugins/inspector.py",line 
>> > 100,invalidate 
>> >      valid =self.is_valid(qstr) 
>> > 
>> File"/usr/lib/python2.7/dist-packages/spyderlib/plugins/inspector.py",line 
>> > 82,inis_valid 
>> > returnshell.is_defined(objtxt,force_import=True) 
>> > 
>> File"/usr/lib/python2.7/dist-packages/spyderlib/widgets/internalshell.py",line
>>  
>>
>> > 453,inis_defined 
>> > returnself.interpreter.is_defined(objtxt,force_import) 
>> > File"/usr/lib/python2.7/dist-packages/spyderlib/interpreter.py",line 
>> > 314,inis_defined 
>> > namespace=self.locals) 
>> > 
>> File"/usr/lib/python2.7/dist-packages/spyderlib/utils/dochelpers.py",line 
>> 292,inisdefined 
>> > module=__import__(base,globals(),namespace) 
>> > File"/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py",line 
>> > 27,in<module> 
>> > from..overrides importoverride,strip_boolean_result,deprecated_init 
>> > ValueError:Attemptedrelative importinnon-package 
>> > | 
>> > So, your answer sounds merely like a bug (or non-implemented feature) 
>> of 
>> > Spyder, and not so much, that I am doing something wrong? 
>>
>> Tracebacks are best read back to front, so the problem seems to be in: 
>>
>> /usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py 
>>
>> in particular: 
>>
>> ValueError: Attempted relative import in non-package 
>>
>> Two things: 
>>
>> 1) Spyder is now at 2.3.3, so you might want to upgrade. 
>>
>
> Trying is worth it.
>

FTR: neither 2.3.3 nor 2.4.0dev make any difference
 

>  
>
>>
>> 2) I honestly think this is Python wrapping GTK problem. My guess is you 
>> will find an answer quicker asking this on a PyGTK/ PyGObject mailing 
>> list. 
>>
>> Where this still does not really explains why the IPython can do at least 
> some completion/documentation and Spyder none (at least in my view).
> Nonetheless the mentioned mailing list is also worth a try, thanks.
>
> I'll be back posting results, if there are any positive ones, although 
> still being happy if there would be someone out there who already solved 
> this (no Spyder/GTK people out there?)
>
> Jaleks
>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to