-1

Today suddenly 'Edit with IDLE' option is gone from context menu. I tried so many things on Regedit keys, not worked. So I downloaded Sublime Text.

First I couldn't even run print("hello") in sublime text, it threw SystemError: Parent module '' not loaded, cannot perform relative import. I deleted Python and re-installed it.

That problem is still occuring, but right now I have another problem on Sublime text. I opened a script (that working perfectly without any error) with Sublime Text for editing. First of all, input() is not working. When I run the script on Sublime Text, I see input line but that's all. It's like Sublime Text prints only the input, not taking data or anything happens after then. I don't know why.

Second problem is, weirdly it raises TabError for EVERY line in the script.

enter image description here

As you see in the picture, break is excatly on the same line with print and time.sleep(). I tried everything and still no solution.

How can I fix this nonsense TabError?

How can I fix input() issue? (I downloaded sublimeRepl but it's not working, there is no option 'Edit with SublimeRepl' or else)

After all, why Edit with IDLE option is gone suddenly and not coming back?

I have tons of scripts and I can't even open a single one. I can't edit anything. Can't run anything.

GLHF
  • 3,835
  • 10
  • 38
  • 83
  • the "why would the 'Edit with IDLE' option disappear" might be more relevent to http://superuser.com even though it is about a programming IDE it is about the program itself. – Tadhg McDonald-Jensen May 17 '16 at 17:01
  • 1
    Try selecting the entire file and changing the indentation settings on the bottom-right from "Tab" to "4 spaces". Also, with "Edit in IDLE" context menu disappeared: have you run any registry cleaners/antivirus scans/system repair tools? If you re-run the Python installer and select "Reinstall", is it fixed? – kirbyfan64sos May 17 '16 at 17:02
  • @kirbyfan64sos Excatly I run a registry cleaner. I knew that was the problem. TabError is gone with your suggest, but `input()` problem is still here. I feel like you're the only one will solve my problem. – GLHF May 17 '16 at 17:05
  • @GLHF Registry cleaners are almost *never* a good thing. Your `input()` issue is that [Sublime doesn't support input](http://stackoverflow.com/questions/10604409/sublime-text-2-console-input). – kirbyfan64sos May 17 '16 at 17:07
  • And I'm pretty sure re-installing Python like I said will fix the context menu issue. – kirbyfan64sos May 17 '16 at 17:07
  • @kirbyfan64sos Yes then I searched for SublimeRepl but it doesn't work as expected. No I re-installed it, even I clean the reg keys of it. Still same. – GLHF May 17 '16 at 17:08
  • What if you try [this](http://superuser.com/a/343565/217624) but replace the `27` in `Python27` with `34`? – kirbyfan64sos May 17 '16 at 17:15
  • @kirbyfan64sos Weirdly, that context menu issue is solved but not completely. I can edit some files but can't some files. I try to open that files with `Python Launcher for Windows` because it says this on that files I can edit. But when I search for that, computer can't find 'Python Launcher for Windows'. – GLHF May 17 '16 at 17:19
  • Actually edit with IDLE works for only .pyw extension right now I understood that – GLHF May 17 '16 at 17:20
  • Is there any pattern for where exactly it works? Or is it seemingly random? Also, are you *positive* you changed *all* the `27`s to `34`s? There's a reason I don't use Windows much anymore. ;) – kirbyfan64sos May 17 '16 at 17:21
  • Also, what's the output if you run `assoc .py` at a command promot window? – kirbyfan64sos May 17 '16 at 17:22
  • .py = Python.File this is the output – GLHF May 17 '16 at 17:26
  • @kirbyfan64sos If you solve this problem when this question eligible for bounty in 2 days, I'll give you 200 bounty points. I'll freak out because of this nonsense problems. – GLHF May 17 '16 at 17:46
  • @GLHF So "Edit with IDLE" still doesn't appear for `.py` files, but it does for `.pyw` files, correct? – kirbyfan64sos May 17 '16 at 19:55
  • @kirbyfan64sos Yes that's true. – GLHF May 18 '16 at 07:18

1 Answers1

0

More than likely you have a mix of spaces and tabs. For Python I have a syntax specific Sublime-settings that shows whitespace characters draw_white_space": "all", so that these issues can be quickly seen. I also have it so that tabs are changed to spaces. My settings are below, feel free to modify as you wish:

{
    // editor options
    "draw_white_space": "all",

    // tabs and whitespace
    "auto_indent": true,
    "rulers": [79],
    "smart_indent": true,
    "tab_size": 4,
    "trim_automatic_white_space": true,
    "use_tab_stops": true,
    "word_wrap": true,
    "wrap_width": 80,
    "translate_tabs_to_spaces": true
}

As for the Edit with IDLE context missing, you may want to take a look at this answer or this answer to see if you can add it back.

Community
  • 1
  • 1
Cory Shay
  • 1,204
  • 8
  • 12
  • Where I should put these settings? Also it doesn't make any sense since all of them are on the same line, but only `break` raises error on that picture. – GLHF May 17 '16 at 16:58
  • When you have a Python file open, you can go to `Preferences -> Settings - More -> Syntax Specific - User` and it should open a `Python.sublime-settings` file, where you can paste the above JSON. More information can be found about the options on [Sublime's unofficial documentation](http://docs.sublimetext.info/en/latest/customization/settings.html) – Cory Shay May 17 '16 at 17:02