Home Download Buy Blog Forum Support

Fast way to select current function in python?

Re: Fast way to select current function in python?

Postby wuub on Mon Jun 10, 2013 2:20 pm

1) check if eyeball is installed in your python3 -> `c:\python32\python.exe -m eyeball` should wait for input.
2) Eyeball works with python files that can be parsed i.e. are syntactically correct. For example if you are trying to parse Python2.x with print "something" using python3.2 it will not work as print is no longer a keyword. This is why you can have multiple pythons configured, SublimeEyeball try them in order untill one returns correct results.

Edit: I did not check for py3.2 compatibility before, but it doesn't seem to be a problem here https://travis-ci.org/wuub/eyeball
Last edited by wuub on Mon Jun 10, 2013 2:23 pm, edited 1 time in total.
SublimeREPL via Package Control & SublimePTY dev/pre-alpha. Donations are appreciated, but not required :) Twitter: @wuub
wuub
 
Posts: 218
Joined: Wed Aug 10, 2011 8:16 am
Location: Poland

Re: Fast way to select current function in python?

Postby sfranky on Mon Jun 10, 2013 2:31 pm

hmm that previous post i made was completely wrong, I m still looking into it..
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Fast way to select current function in python?

Postby sfranky on Mon Jun 10, 2013 2:37 pm

eeer ok found the problem. It wasn't syntactically correct :oops:
Works perfect now !! many thanks !!
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Fast way to select current function in python?

Postby sfranky on Mon Jun 10, 2013 2:44 pm

It is very weird though, I have the following code:
Code: Select all
    def __init__(self):
        super(PublishedItem,self).__init__()
        # self.tree = ''
        self.XML_publications_root = ''
        # self.AuthorAddresses = "Ν/Α"
        self.Abstract = "unbounded"
        self.ArticleNumber = "unbounded"
        self.AuthorAddresses = [] # this contains the orig addresses coming in
        self.Address_AuthorsDict = dict()
        self.Authors = []
        self.AuthorFullName = []


and it doesn't work because of the fifth line. Why is that? it's commented anyway!
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Fast way to select current function in python?

Postby wuub on Mon Jun 10, 2013 2:47 pm

sfranky wrote:It is very weird though, I have the following code:
and it doesn't work because of the fifth line. Why is that? it's commented anyway!


No problems on my end whatsoever. Works like a charm with this example. :(

EDIT
In SublimeEyeball/eyeball_select.py try to print(out) & print(err) in line 19. Maybe it'll tell us something.
SublimeREPL via Package Control & SublimePTY dev/pre-alpha. Donations are appreciated, but not required :) Twitter: @wuub
wuub
 
Posts: 218
Joined: Wed Aug 10, 2011 8:16 am
Location: Poland

Re: Fast way to select current function in python?

Postby sfranky on Mon Jun 10, 2013 3:02 pm

hmm strange...very strange. Upon seeing the messages below, I overwrote (in insert mode) all the characters of the line, character by character. And now it works fine.. how is this possible?
Code: Select all
b''
b'Traceback (most recent call last):
  File "c:\\Python32\\lib\\runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\\Python32\\lib\\runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "c:\\Python32\\lib\\site-packages\\eyeball\\__main__.py", line 33, in <module>
    main()
  File "c:\\Python32\\lib\\site-packages\\eyeball\\__main__.py", line 27, in main
    code = sys.stdin.read()
  File "c:\\Python32\\lib\\encodings\\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: \'charmap\' codec can\'t decode byte 0x9d in position 11251: character maps to <undefined>
'
SublimeEyeball c:\Python32\pythonw.exe No JSON object could be decoded
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Fast way to select current function in python?

Postby wuub on Mon Jun 10, 2013 3:10 pm

Yeah, encodings and stdio handling on windows.
One of my favourite things to debug, right after killing process trees with cmd.exe in them...

I'll try to take make it more reliable soon, it would be great if you could assemble a small problematic file and create a github issue ?
SublimeREPL via Package Control & SublimePTY dev/pre-alpha. Donations are appreciated, but not required :) Twitter: @wuub
wuub
 
Posts: 218
Joined: Wed Aug 10, 2011 8:16 am
Location: Poland

Re: Fast way to select current function in python?

Postby sfranky on Mon Jun 10, 2013 3:50 pm

I will, as soon as you tell me how to reproduce it !! I wiped the bad line and replaced it with a working one, and now I can't make it *not* work.. :roll:
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Fast way to select current function in python?

Postby sfranky on Tue Jun 11, 2013 9:08 am

btw, is there a way for the screen to follow the cursor?
if i ctrl+shift+c while inside a function that extends outside the screen, i can't see the cursor anymore. I would expect to find this setting in ST itself, but it doesn't seem to exist.. is it intended in your plugin?
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Fast way to select current function in python?

Postby wuub on Tue Jun 11, 2013 9:45 am

sfranky wrote:btw, is there a way for the screen to follow the cursor?
if i ctrl+shift+c while inside a function that extends outside the screen, i can't see the cursor anymore. I would expect to find this setting in ST itself, but it doesn't seem to exist.. is it intended in your plugin?


Could you report any issues and questions in the github repo?
Here: https://github.com/wuub/SublimeEyeball/issues
if it's something related to Sublime integration (like the problem above)

Or here: https://github.com/wuub/eyeball/issues
if you think it's a problem with the library itself (wrong selection, tracebacks and so on). If you aren't sure which one is correct, just pick one at random ;)

I tend to not check those threads regularly, and when I do I later forget about the reported issues.
SublimeREPL via Package Control & SublimePTY dev/pre-alpha. Donations are appreciated, but not required :) Twitter: @wuub
wuub
 
Posts: 218
Joined: Wed Aug 10, 2011 8:16 am
Location: Poland

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 19 guests