4

I am new to python but have been using both IDLE and EricIDE for a few weeks without any major problems.

I was editing a program I had written that called random.randint() function and it wouldn't work.
Previously, this program had been working and I had not changed that call out.
I then loaded another program that uses the same function that had been working and it would not run either.
I tried to load the program in IDLE but IDLE wouldn't load. After trying several reboots and reloads EricIDE wouldn't load either. I noticed a black window popping up and disappearing quickly when I try to launch either IDE from my previously working desktop shortcuts.
Searching for help led me to run python shell from the windows command line by going to C:\python33\ and typing "python" to run python shell, I get:

File "C:\python33\lib\sre_constants.py", line 18, in (module)

from _sre import MAXREPEAT

ImportError: cannot import name MAXREPEAT

I am using Windows 8 (new to it as well and still trying to figure it out).

At this point I'm assuming my problem is with my python installation since the python shell won't work. I have uninstalled and reinstalled Python 3.3.1 but the problem persists. I also deleted the .idlerc folder from my Users directory as suggested in another thread that was similar to my problem but that doesn't seem to have helped either.

Thank you for any help you can provide.


response to eryksun:

C:\Python33>python.exe -c "import sys; print(sys.path)"
Traceback (most recent call last):
  File "C:\Python33\lib\site.py", line 70, in <module>
    import re
  File "C:\Python33\lib\re.py", line 122, in <module>
    import sre_compile
  File "C:\Python33\lib\sre_compile.py", line 14, in <module>
    import sre_parse
  File "C:\Python33\lib\sre_parse.py", line 17, in <module>
    from sre_constants import *
  File "C:\Python33\lib\sre_constants.py", line 18, in <module>
    from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT

C:\Python33>python.exe -S -c "import sys; print(sys.path)"
['', 'C:\\Python33\\python33.zip', 'C:\\Python33\\DLLs', 
 'C:\\Python33\\lib', 'C:\\Python33']

Follow up to to eryksun:

C:\Python33>python.exe -S -c "import _imp; _sre = _imp.init_builtin('_sre'); 
print(_sre.MAXREPEAT)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'MAXREPEAT'
Eryk Sun
  • 33,190
  • 5
  • 92
  • 111
user2276695
  • 71
  • 1
  • 6
  • Thank you for the response eryksun, please see my answer below for your comment. – user2276695 Apr 14 '13 at 14:29
  • Here is the result when using the capital "S" C:\Python33>python.exe -S -c "import sys; print(sys.path)" ['', 'C:\\Python33\\python33.zip', 'C:\\Python33\\DLLs', 'C:\\Python33\\lib', 'C:\\Python33'] – user2276695 Apr 14 '13 at 15:32
  • C:\Python33>python.exe -S -c "import _sre; print(_sre)" – user2276695 Apr 14 '13 at 15:44
  • C:\Python33>python.exe -S -c "from _sre import MAXREPEAT; print(MAXREPEAT)" Traceback (most recent call last): File "", line 1, in ImportError: cannot import name MAXREPEAT – user2276695 Apr 14 '13 at 15:57
  • Thank you for the help. Please see an edit to the original post since the output was too long for a comment. Sorry, I am struggling with the auto-foramtting. – user2276695 Apr 14 '13 at 16:18
  • C:\Python33>python.exe -S -c "import _imp; _sre = _imp.init_builtin('_sre'); pri nt(_sre.MAXREPEAT)" Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'MAXREPEAT' – user2276695 Apr 14 '13 at 16:28
  • I completely removed C:\python33 as suggested and reinstalled and it seems to be working now. I'd tried uninstalling and reinstalling previously without success so apparently deleting the folder was necessary. Thank you very much for your help. It appears I'm back up and running. Thanks again eryksun. – user2276695 Apr 14 '13 at 20:44

1 Answers1

2

I suggest you uninstall. Completely remove C:\Python33 and also C:\Windows\System32\python33.dll. _sre is built in to the latter DLL. MAXREPEAT is set by its initialization functionPyInit__sre (Modules/_sre.c). Clearly, something is wrong there.

When you download the 3.3.1 installer, make sure you get the right binary for your platform, i.e. x86 for 32-bit Windows and X86-64 for 64-bit Windows.

Eryk Sun
  • 33,190
  • 5
  • 92
  • 111