1

I am trying to run the python shell through the Django manage.py file like so: $ python manage.py shell --plain

I keep running into this ValueError:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/Users/donnyknight/Desktop/djangoproj/djangoenv/lib/python2.7/site-packages/django/core/management/commands/shell.py", line 77, in handle
    import readline
  File "/usr/local/lib/python2.7/site-packages/readline.py", line 6, in <module>
    from pyreadline.rlmain import Readline
  File "/usr/local/lib/python2.7/site-packages/pyreadline/__init__.py", line 12, in <module>
    from . import logger, clipboard, lineeditor, modes, console
  File "/usr/local/lib/python2.7/site-packages/pyreadline/clipboard/__init__.py", line 13, in <module>
    from .win32_clipboard import GetClipboardText, SetClipboardText
  File "/usr/local/lib/python2.7/site-packages/pyreadline/clipboard/win32_clipboard.py", line 37, in <module>
    import ctypes.wintypes as wintypes
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
    class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported

I am on a mac and see that it is trying to call windows packages, but I am not sure how to configure Django to fix this.

Any help is greatly appreciated.

Edit - The problem may be stemming from the readlines.py file. When trying to import it on it's own, I get:

Traceback (most recent call last):
  File "/Users/donnyknight/Desktop/Django/djangotest/mysite/test.py", line 1, in <module>
    import readline
ImportError: dlopen(/Users/donnyknight/Desktop/Django/djangoenv/lib/python2.7/readline.so, 2): no suitable image found.  Did find:
/Users/donnyknight/Desktop/Django/djangoenv/lib/python2.7/readline.so: file too short

Edit #2 - It seems like its a problem with virtualenv. Running this command outside of the virtualenv works fine.

8
  • Related: stackoverflow.com/questions/32608232/… Commented Jan 21, 2016 at 20:42
  • @ShangWang: alright i'll give that a go if it seems to be the only solution. Commented Jan 21, 2016 at 20:56
  • Related, stackoverflow.com/questions/33645471/… Commented Jan 21, 2016 at 20:58
  • @SaeX: I saw that before, it doesn't really provide a solution, though. Commented Jan 21, 2016 at 20:59
  • @ShangWang: No dice, tried a different python version and am having the same problem. Commented Jan 21, 2016 at 21:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.