-# Copyright (C) 2009-2016 EDF R&D
+# Copyright (C) 2009-2019 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
>>> s1 = module_generator.Service('myservice', inport=[("a","double"),],
instream=[("aa","CALCIUM_double","I")],
- body="print a")
+ body="print( a)")
"""
"""
for name, content in list(dic.items()):
filename = os.path.join(basedir, name)
- if isinstance(content, basestring):
- if isinstance(content, unicode):
- # encodage to utf-8 if unicode string
- content=content.encode('utf8')
- fil = open(filename, 'w')
- fil.write(content)
- fil.close()
+ if isinstance(content, str):
+ # encodage to utf-8 if unicode string / on python3 str are unicode
+ with open(filename, 'w') as fil:
+ fil.write(content)
else:
if not os.path.exists(filename):
os.makedirs(filename)