From 538100148fc6adead860b28591e3be74cadbdc3f Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Fri, 7 Sep 2018 17:59:59 +0530 Subject: [PATCH] [py3] print, StringIO import, and other fixes --- .../doctype/amazon_mws_settings/amazon_methods.py | 10 +++++++--- .../doctype/amazon_mws_settings/amazon_mws_api.py | 2 +- .../doctype/amazon_mws_settings/amazon_mws_settings.py | 2 +- erpnext/healthcare/utils.py | 6 +++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py index cb11ece175..3234e7a332 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py @@ -3,8 +3,12 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe, time, dateutil, math, csv, StringIO -import amazon_mws_api as mws +import frappe, time, dateutil, math, csv +try: + from StringIO import StringIO +except ImportError: + from io import StringIO +import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws from frappe import _ #Get and Create Products @@ -22,7 +26,7 @@ def get_products_details(): listings_response = reports.get_report(report_id=report_id) #Get ASIN Codes - string_io = StringIO.StringIO(listings_response.original) + string_io = StringIO(listings_response.original) csv_rows = list(csv.reader(string_io, delimiter=str('\t'))) asin_list = list(set([row[1] for row in csv_rows[1:]])) #break into chunks of 10 diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py index 1e131e8ec0..bf6d85b911 100755 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py @@ -9,7 +9,7 @@ import urllib import hashlib import hmac import base64 -import xml_utils +from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils import re try: from xml.etree.ElementTree import ParseError as XMLError diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py index 7e64915c3f..7f1ee9ca97 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py @@ -7,7 +7,7 @@ import frappe from frappe.model.document import Document import dateutil from frappe.custom.doctype.custom_field.custom_field import create_custom_fields -from amazon_methods import get_products_details, get_orders +from erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods import get_products_details, get_orders class AmazonMWSSettings(Document): def validate(self): diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py index 1045d495b7..1be82e2cad 100644 --- a/erpnext/healthcare/utils.py +++ b/erpnext/healthcare/utils.py @@ -307,8 +307,8 @@ def manage_fee_validity(appointment_name, method, ref_invoice=None): fee_validity = create_fee_validity(appointment_doc.practitioner, appointment_doc.patient, appointment_doc.appointment_date, ref_invoice) visited = fee_validity.visited - print "do_not_update: ", do_not_update - print "visited: ", visited + print("do_not_update: ", do_not_update) + print("visited: ", visited) # Mark All Patient Appointment invoiced = True in the validity range do not cross the max visit if (method == "on_cancel"): @@ -410,7 +410,7 @@ def get_children(doctype, parent, company, is_root=False): lft > %s and rgt < %s""", (each['lft'], each['rgt'])) for child in child_list: - print child[0], child[1] + print(child[0], child[1]) if not occupied: occupied = 0 if child[1] == "Occupied":