Problems with running Mantis import script

I'm trying to run the python mantis import script and have run into a few problems.

The first thing I treid was to runn the connection test script as recommended in the docs. 

python tests/

(as it said to do in this document)

Immediately, i got this error:

Traceback (most recent call last):

  File "tests/", line 3, in <module>

    from youtrack.connection import Connection, youtrack, os, os

ImportError: No module named youtrack.connection

I resolved this by adding the path to the root of the python client library to the PYTHONPATH environment var.

Then I ran the script again and got:



ERROR: test_createAndDeleteSubsystem (__main__.ConnectionTest)


Traceback (most recent call last):

  File "tests/", line 11, in setUp

    self.con = Connection('', 'resttest', 'resttest')

  File "c:\youtrack-remote-api\python\youtrack\", line 16, in __init__    self._login(login, password)

  File "c:\youtrack-remote-api\python\youtrack\", line 23, in _login

    raise youtrack.YouTrackException('/user/login', response, content)

YouTrackException: Error for [/user/login]: 403: Forbidden: Incorrect login or password.

... plus a few more of the same type of error (8 in all)

That makes sense, I guess, since I didn't provide any login info but I'm not sure what the test is really meant to accomplish and the docs didn't say anything about login credentials.

For kicks, I then tried to run the mantis script using the docs found here.  I got these errors:

Traceback (most recent call last):

  File "", line 332, in <module>


  File "", line 18, in main

    mantis_port, mantis_login, mantis_pass, mantis_product_names)

  File "", line 132, in mantis2youtrack

    target = Connection(target_url,target_login, target_pass)

  File "c:\youtrack-remote-api\python\youtrack\", line 16, in __ini


    self._login(login, password)

  File "c:\youtrack-remote-api\python\youtrack\", line 23, in _logi


    raise youtrack.YouTrackException('/user/login', response, content)

youtrack.YouTrackException: Error for [/user/login]: 501: Not Implemented

This is YouTrack 2.1.2 and I'm using the script that I downloaded today (whatever version that is).  I'm using Python 2.6.2.

It seems like there's an important step that I missed in this process.  Does anyone know what it is?

1 comment
Comment actions Permalink

You are right, to run tests you should provide login info. In this line

self.con = Connection('', 'resttest', 'resttest')

you should cange 'htp://' to your youtrack server address and 'resttest' 'resttest' to your login and password.

But, first of all you should enable REST API in your youtrack settings. If you didn't do that you can enable it on the 'Settings' tab of youtrack admin menu.


Please sign in to leave a comment.