Skip to content

Commit

Permalink
fix import encoding for python2
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Nov 24, 2017
1 parent 2011019 commit 6785fd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rdmo/core/management/commands/import.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io

from lxml import objectify

from django.contrib.auth.models import User
Expand All @@ -19,7 +21,7 @@ def add_arguments(self, parser):
parser.add_argument('--user', action='store', default=False, help='RDMO username for this import')

def handle(self, *args, **options):
with open(options['xmlfile'], encoding='utf8') as f:
with io.open(options['xmlfile'], encoding='utf8') as f:
xml_root = objectify.parse(f).getroot()

if xml_root.tag == 'conditions':
Expand Down

0 comments on commit 6785fd3

Please sign in to comment.