Need help with CSV Import

Hi all,

I'm trying to import a .csv file (which contains data from our existing bugtracker) into YouTrack.

I'm using the information from the YouTrack wiki to get this done (http://confluence.jetbrains.net/display/YTHB/Import+from+a+CSV+File)

I can't get it to work though, who can help me with the following issues?

- I need some kind of example of a csv mapping file

- How do you execute the python script with commandline inputs? (do i have to add the 'python' command as a system variable?)

- Can the import script create a new YouTrack project or can you only import into existing YouTrack projects?

I would be really grateful with any help, thanks in advance

8 comments
Comment actions Permalink

Hello!

-You can find examples in "csv" folder in python library.

-You should have python installed on your computer. After that you should simply type this command

python csv2youtrack.py target_host target_login target_password project_id project_name path_to_csv_file

in command line.

-Yes, import script can create new project, so you shouldn't create it manually.

If you have any more questions -- feel free to ask!

0
Comment actions Permalink

Hi, Thanks for your reply.

I've looked over the csv mapping file example that was in youtrack-python-api-3.0.2-44. I assume that is the folder that you were referring to.

And I've created a mapping file, which I stripped to a bare minimum to test the functionality, and this mapping files matches my .csv file.

I still have trouble executing the script with the commandline parameters though.

So, I'm trying to run the command that you listed above, however I get the following errorcode: [Errno 2] No such file or directory.

I think it has something to do with the PYTHONPATH variable.

I've added <fullpath to youtrack-python-wrapper>\python\ to my systemvariable 'PYTHONPATH', no succes unfortunately. I read somewhere that you can put 3rd party modules in 'Python27/Lib/site-packages', but that also doesn't work.

Can you help me out or do you have any suggestions that might work?

0
Comment actions Permalink

Alright I finally got it to work, at least with my very simple testcase (=simple csv file + simple mapping file)

A couple of pointers that might help other people:

- Make sure that python.exe is added to your environment variable:  'PATH'

- If you can't get PYTHONPATH to work, execute the commandline command from the folder where your *.py file is located

- Refer to the 'target_host' parameter with the absolute IP-Address of your YouTrack installation. (For the localhost: http://127.0.0.1:80)

- It's easy to put your *.csv file in the same folder as the *.py script, otherwise use the full path to the *.csv file.

These pointers might seem easy, but it isn't documented properly in the YouTrack wiki.

0
Comment actions Permalink

Ok I've got a different question now, I'm having trouble with mapping to the 'state' and 'type' fields.

My mapping file contains this code:

csvClient.VALUES = {

    "priority"      :   {"Minor" : "2", "Major" : "3", "Critical" : "1"},

     "type"           :   {"Error" : "2", "Deficiency" : "3", "Request" : "1"},

     "state"      : {"Not-Processed" : "0", "Solved" : "1", "Disclaimed" : "2", "Rejected" : "3", "In-Progress" : "4", "Postponed" : "5"}

}

But I get the following error message (shown in the output script):

<item id="1" imported="false"><error fieldName="Type" value="1">Value is unknown</error><error fieldName="State" value="1">Value is unknown</error></item>

Value is unknown.. why is that? I've added my custom strings to the fields in YouTrack Settings.

Who can help me out?

0
Comment actions Permalink

Hello!

Could you please provide just few lines of your csv files, where those types are mentioned?

0
Comment actions Permalink

Hi Anna, thanks for your reply. I've posted some more information below, please note that it's not the complete .csv file or complete mapping.

csvClient.FIELDS = {

    "numberInProject"   :   "ID",

    "summary"           :   "R_Error_SDescription",

    "created"           :   "Error_Detection_Date",

    "type"              :   "Error_Level",

    "priority"          :   "Priority",

    "state"             :   "Processed_Type"

}

CSV File (shortened):

ID Error_Detection_Date Error_Level R_Error_SDescription Priority Processed_Type
1 14-11-2011 1 description 1 1 1
2 14-11-2011 2 description 2 3 1
3 14-11-2011 2 description 3 3 3

Is it possible that you can't map an integer to a string or something?

0

Please sign in to leave a comment.