0

I've seen this question asked already but I think my situation is unique. I recently installed MYSQL and since then whenever I run python manage.py runserver I get this error:

Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
le>
    from django.apps import apps
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    from .config import AppConfig
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    from django.core.exceptions import AppRegistryNotReady, Imprope
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    from django.utils.encoding import force_text
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    from django.utils.six.moves.urllib.parse import quote, unquote
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    result = self._resolve()
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    module = _import_module(self.mod)
  File "C:\Users\ELITEBOOK\.virtualenvs\charles\lib\site-packages\d
    __import__(name)
  File "c:\python27\Lib\urllib.py", line 26, in <module>
    import socket
  File "c:\python27\Lib\socket.py", line 47, in <module>
    import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.

Could MYSQL be interfering with my Python installation? I tried uninstalling Python, and deleting all the files. Then reinstalling 32-bit Python but to no avail.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Amon
  • 2,725
  • 5
  • 30
  • 52
  • 2
    Open idle type `from socket import _socket`, not module issue if haven't any error. `DLL load failed: %1 is not a valid Win32 application.` [socket use .pyc bytecode not an DLL](http://stackoverflow.com/questions/2705304/how-to-import-pyc-file-from-different-version-of-python) Check your os/python default C compiler/module. – dsgdfg Dec 01 '16 at 06:34
  • I tried importing _socket and I receive the same message, how do I check my default compiler? – Amon Dec 01 '16 at 21:05
  • 1
    `python manage.py runserver` to `C:\Python2.7\ python.exe manage.py runserver` so you got 3 paths (Python_Path, App_path, Virtualenv_Path ). Some libraries is on shared (Single module for all pyhon versions), you can't call with default_ver_python upper_version_python_module. – dsgdfg Dec 05 '16 at 19:34
  • @dsgdfg Hey thanks for the response, I actually edited the question. I got it to work. I uninstalled one of the versions of Python I had and reinstalled the x86-64 version. Thank you again for the help – Amon Dec 05 '16 at 21:31
  • Please don't edit the question with solutions! Post answers instead. This makes your question seem open while you actually solved it... – Tomerikoo Jan 20 '21 at 07:59

1 Answers1

1

OP solved the problem themselves, this solution was edited into the question:


I solved the issue, it looks like I had two versions of Python installed and didn't know it. I uninstalled both versions and reinstalled the x86-64 version

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61