Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm cant open manage.py task

In one of my projects , I cannot open manage task console. It works for other projects but not for this one. It worked before, but it stopped recently. I tried using old versions of the project, but its still broken. I get this error:

    Failed to get real commands on module "Visdjango": python process died with code 1: Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.1\helpers\pycharm\manage_tasks_provider.py", line 22, in <module>
    parser.report_data(dumper)
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.1\helpers\pycharm\django_manage_commands_provider\_parser\parser.py", line 40, in report_data
    module_to_use.process_command(dumper, command, command.create_parser("", command_name))
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.1\helpers\pycharm\django_manage_commands_provider\_parser\_optparse.py", line 23, in process_command
    dumper.set_arguments(command.args)
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.1\helpers\pycharm\django_manage_commands_provider\_xml.py", line 95, in set_arguments
    self.__command_element.setAttribute("args", VersionAgnosticUtils().to_unicode(command_args_text))
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.1\helpers\pycharm\utils.py", line 36, in to_unicode
    return unicode(obj.decode("utf-8"))
AttributeError: 'list' object has no attribute 'decode'
like image 235
Luka Prelic Avatar asked May 22 '15 18:05

Luka Prelic


People also ask

How do I open manage py?

manage.py should live in the root project folder, so if you cd into C:Users/arpchauh/PycharmProjects/post_blog , you should be able to run the command.

How do I enable Django in PyCharm?

Open the project Settings/Preferences dialog ( Ctrl+Alt+S ) and navigate to the Languages & Frameworks | Django page. Make sure that the checkbox Enable Django support is selected. Apply changes (if any) and close the dialog.

What is manage py in Django?

Manage.py in Django is a command-line utility that works similar to the django-admin command. The difference is that it points towards the project's settings.py file. This manage.py utility provides various commands that you must have while working with Django.


3 Answers

update your _utils.py in YOUR_PYCHARM_INSTALLATION_DIR\helpers\pycharm\django_manage_commands_provider\_parser\_utils.py

and changes the code in line 20:

assert isinstance(opt.choices, list), "Choices should be list"

with

assert isinstance(opt.choices, (list, tuple)), "Choices should be list or tuple"
like image 86
Yuda Prawira Avatar answered Sep 30 '22 23:09

Yuda Prawira


Install version 4.5.3 RC

If you are using a virtual environment, make sure your project interpreter (settings > Project:... > Project Interpreter) points to the python executable in it (e.g., my_virtual_env/bin/python3.4).

If you are using a virtual machine, you also need to have your project interpreter setting point to the python version under your virtual environment under your virtual machine. If you are using Vagrant this is easy, as when you try to add a new interpreter PyCharm lets you select Vagrant, and then browse the VM file system to point to the file you needed.

like image 22
mehmet Avatar answered Sep 30 '22 23:09

mehmet


It looks like a bug in the new manage.py tasks integration of PyCharm 4.5. Please report this issue to the PyCharm's issue tracker.

like image 22
Andrey Vlasovskikh Avatar answered Sep 30 '22 23:09

Andrey Vlasovskikh