spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.29k stars 1.61k forks source link

Problems while running selection / current block #420

Closed spyder-bot closed 9 years ago

spyder-bot commented 9 years ago

From d.turaev@gmail.com on 2010-10-20T04:18:33Z

What steps will reproduce the problem?

  1. Write the following lines in the Spyder editor: def tmp(): if 1: # some annotation print "hello"
    1. Mark these lines and execute by pressing F9 3. What is the expected output? What do you see instead? Expected output: lines are executed in the Ipython shell (function is defined) Instead: Ipython complains about indentation error What version of the product are you using? On what operating system? Version 2.0.0beta5 on Fedora13

Please provide any additional information below

. If this function is defined in a usual Ipython shell, the error happens if the "print "hello"" line is indented via spacebar; it does not happen if it is indented via the tab key. In the shell which is integrated into Spyder, this doesnt seem to be the case. No idea, whether it is relevant.


Executing selected parts of code by hitting a key is one of the most important features of Spyder for me. Some further ideas about this topic:

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=420

spyder-bot commented 9 years ago

From hannes.k...@gmail.com on 2010-10-27T14:07:07Z

Hi, I just started using this great editor and stubled over this bug too: when I try to execute a selected code-block which has intendations then the code gets not executed and the python shell complains about intendations.

I had a short look at the code ( spiderlib/widgets/editor.py , method __process_lines() to be precise) and I think the problem has something to do with line-separators: On my system the call to get_line_separator() returns '\n' but the line-separator actually present in the selected text is the unicode character 2029.

Manually setting the line-sepeartor like this

ls= u'\u2029'

at the beginning of the __process_lines() method makes this problem go away for me. I know thats not a very good fix of course, but I hope it might help in tracking down the source of the problem.

cheers :)

spyder-bot commented 9 years ago

From pierre.raybaut on 2010-10-28T02:10:06Z

hannes.koller: could you please create another "Issue" with a test case for your problem (which I can't reproduce: your change in editor.py does nothing on the bug described by d.turaev) with the exact traceback from IPython.

spyder-bot commented 9 years ago

From hannes.k...@gmail.com on 2010-10-29T13:33:46Z

Hi

thanks for your Feedback. I have opened a separate issue for my problem under https://code.google.com/p/spyderlib/issues/detail?id=432

spyder-bot commented 9 years ago

From ccordoba12 on 2011-05-15T19:40:47Z

Labels: Cat-Console

spyder-bot commented 9 years ago

From ccordoba12 on 2011-09-12T11:25:31Z

Status: Duplicate
Mergedinto: 660