<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">It took me sometime to figure that I have to first fork, create a branch, apply the patch, commit and create a pull request but I think I have now understood
 how it works ;-)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">So, I’ve created the pull request. Could you have a look at it?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Serge<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> pythondotnet-bounces+serge.weinstock=uk.bnpparibas.com@python.org
 [mailto:pythondotnet-bounces+serge.weinstock=uk.bnpparibas.com@python.org] <br>
<b>Sent:</b> 27 August 2014 17:34<br>
<b>To:</b> pythondotnet@python.org<br>
<b>Subject:</b> Re: [Python.NET] Running an embedded interpreter<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Serge,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I don't see your pull request here <a href="https://github.com/renshawbay/pythonnet/pulls">https://github.com/renshawbay/pythonnet/pulls</a>, and I can't see your fork. Could you send me the url of your fork and I'll take a look if I can
 pull the changes from there?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">If you want to have another go at creating the pull request this might help:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Aug 27, 2014 at 2:02 PM, Serge WEINSTOCK <<a href="mailto:serge.weinstock@uk.bnpparibas.com" target="_blank">serge.weinstock@uk.bnpparibas.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Tony,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’ve submitted the fix. As I’m new to git and github, I’m not sure I’ve done the right steps. Let
 me know if you can’t find my patch</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Serge</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> pythondotnet-bounces+serge.weinstock=<a href="mailto:uk.bnpparibas.com@python.org" target="_blank">uk.bnpparibas.com@python.org</a>
 [mailto:<a href="mailto:pythondotnet-bounces%2Bserge.weinstock" target="_blank">pythondotnet-bounces+serge.weinstock</a>=<a href="mailto:uk.bnpparibas.com@python.org" target="_blank">uk.bnpparibas.com@python.org</a>]
<br>
<b>Sent:</b> 26 August 2014 16:54</span><o:p></o:p></p>
<div>
<div>
<p class="MsoNormal"><br>
<b>To:</b> <a href="mailto:pythondotnet@python.org" target="_blank">pythondotnet@python.org</a><br>
<b>Subject:</b> Re: [Python.NET] Running an embedded interpreter<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi Serge,<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">ah great, good spot.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Certainly, please send a pull request to the github repo and I'll merge it.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Tony<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Tue, Aug 26, 2014 at 1:07 AM, Serge WEINSTOCK <<a href="mailto:serge.weinstock@uk.bnpparibas.com" target="_blank">serge.weinstock@uk.bnpparibas.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi Tony,<br>
<br>
I think I've found the issue:<br>
The signatures of Py_SetPythonHome, Py_GetPythonHome, Py_SetProgramName and Py_GetProgramName have changed from python 2.x to python 3.x: the strings are now Unicode strings.<br>
<br>
I've done the following patches (I've also added support for Py_SetPath and Py_GetPath as I needed to set up myself sys.path):<br>
* runtime.cs<br>
//==================================================================<br>
#if PYTHON32 || PYTHON33 || PYTHON34<br>
    [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,<br>
         ExactSpelling=true, CharSet=CharSet.Ansi)]<br>
    [return: MarshalAs(UnmanagedType.LPWStr)]<br>
        internal unsafe static extern string<br>
        Py_GetProgramName();<br>
<br>
    [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,<br>
        ExactSpelling=true, CharSet=CharSet.Ansi)]<br>
        internal unsafe static extern void<br>
        Py_SetProgramName([MarshalAsAttribute(UnmanagedType.LPWStr)]string name);<br>
<br>
    [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,<br>
        ExactSpelling=true, CharSet=CharSet.Ansi)]<br>
    [return: MarshalAs(UnmanagedType.LPWStr)]<br>
        internal unsafe static extern string<br>
        Py_GetPythonHome();<br>
<br>
    [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,<br>
        ExactSpelling=true, CharSet=CharSet.Ansi)]<br>
        internal unsafe static extern void<br>
        Py_SetPythonHome([MarshalAsAttribute(UnmanagedType.LPWStr)]string home);<br>
<br>
    [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,<br>
        ExactSpelling=true, CharSet=CharSet.Ansi)]<br>
    [return: MarshalAs(UnmanagedType.LPWStr)]<br>
        internal unsafe static extern string<br>
        Py_GetPath();<br>
<br>
    [DllImport(Runtime.dll, CallingConvention=CallingConvention.Cdecl,<br>
        ExactSpelling=true, CharSet=CharSet.Ansi)]<br>
        internal unsafe static extern void<br>
        Py_SetPath([MarshalAsAttribute(UnmanagedType.LPWStr)]string home);<br>
#else<br>
    [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,<br>
          ExactSpelling = true, CharSet = CharSet.Ansi)]<br>
    internal unsafe static extern string<br>
    Py_GetProgramName();<br>
<br>
    [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,<br>
        ExactSpelling = true, CharSet = CharSet.Ansi)]<br>
    internal unsafe static extern void<br>
    Py_SetProgramName(string name);<br>
<br>
    [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,<br>
        ExactSpelling = true, CharSet = CharSet.Ansi)]<br>
    internal unsafe static extern string<br>
    Py_GetPythonHome();<br>
<br>
    [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,<br>
        ExactSpelling = true, CharSet = CharSet.Ansi)]<br>
    internal unsafe static extern void<br>
    Py_SetPythonHome(string home);<br>
<br>
    [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,<br>
        ExactSpelling = true, CharSet = CharSet.Ansi)]<br>
    internal unsafe static extern string<br>
    Py_GetPath();<br>
<br>
    [DllImport(Runtime.dll, CallingConvention = CallingConvention.Cdecl,<br>
        ExactSpelling = true, CharSet = CharSet.Ansi)]<br>
    internal unsafe static extern void<br>
    Py_SetPath(string home);<br>
#endif<br>
//==================================================================<br>
PythonEngine.cs<br>
//==================================================================<br>
public static string PythonPath {<br>
    get<br>
    {<br>
        string result = Runtime.Py_GetPath();<br>
        if (result == null)<br>
        {<br>
            return "";<br>
        }<br>
        return result;<br>
    }<br>
    set<br>
    {<br>
        Runtime.Py_SetPath(value);<br>
    }<br>
}<br>
//==================================================================<br>
<br>
Could you add these patches to the source repository?<br>
<br>
Thanks,<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Serge<br>
<br>
<br>
<br>
From: pythondotnet-bounces+serge.weinstock=<a href="mailto:uk.bnpparibas.com@python.org" target="_blank">uk.bnpparibas.com@python.org</a> [mailto:<a href="mailto:pythondotnet-bounces%2Bserge.weinstock" target="_blank">pythondotnet-bounces+serge.weinstock</a>=<a href="mailto:uk.bnpparibas.com@python.org" target="_blank">uk.bnpparibas.com@python.org</a>]<o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Sent: 21 August 2014 14:43<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">To:
<a href="mailto:pythondotnet@python.org" target="_blank">pythondotnet@python.org</a><br>
Subject: Re: [Python.NET] Running an embedded interpreter<br>
<br>
Hi Serge,<br>
<br>
sorry, not sure why one would work and not the other. For what it's worth, I've been using the 3.2 x64 version for some time now, both for calling .NET from python and for embedding Python into a .NET application without any problem like the ones you describe.<br>
<br>
What I suggest you try is grabbing the latest code from the renshawbay repo and build that using setupwin.py - you might want to edit that file to build the debug project. Then you will be able to step through and see exactly where it's going wrong. You can
 build it from visual studio if you prefer, but you will have to be careful to set some of the defines correctly; look at setupwin.py to see what needs setting.<br>
<br>
You can also download the pdb files and python source from <a href="http://python.org" target="_blank">
python.org</a>, which should allow you step into the python source code without having to build python yourself.<br>
<br>
Best regards,<br>
Tony<br>
<br>
<br>
On Thu, Aug 21, 2014 at 10:36 AM, Serge WEINSTOCK <<a href="mailto:serge.weinstock@uk.bnpparibas.com" target="_blank">serge.weinstock@uk.bnpparibas.com</a>> wrote:<br>
Hi Tony,<br>
<br>
I’ve noticed that you are the main contributor for this branch of Python for .Net. Thanks a lot for that contribution.<br>
<br>
Maybe you can help me a little more with my issue. I think the main issue is due to the fact that I’m using Python 3.2.<br>
<br>
I’ve done the following tests:<br>
*  Python 3.2 x86:<br>
    * calling .Net libraries from standard python interpreter: works fine.<br>
    * running embedded interpreter from .Net application:<br>
          * from Visual Studio: works fine. Setting PYTHONHOME is enough. No need to set PYTHONPATH<br>
          * from command line: doesn't work. Setting PYTHONPATH improves a little things.<br>
*  Python 3.2 x64:<br>
    * calling .Net libraries from standard python interpreter: works fine.<br>
    * running embedded interpreter from .Net application:<br>
          * from Visual Studio: doesn't work. Setting PYTHONPATH improves a little things.<br>
          * from command line: doesn't work. Setting PYTHONPATH improves a little things.<br>
*  Python 3.3 x86:<br>
    * calling .Net libraries from standard python interpreter: works fine.<br>
    * running embedded interpreter from .Net application:<br>
          * from Visual Studio: works fine.<br>
          * from command line: works fine.<br>
<br>
I've also compared for the VS run or for the command line run:<br>
 * the paths given by 'sys.modules'.  They are the same.<br>
 * the paths of the loaded dlls as given by 'listdlls'. They are the same.<br>
<br>
Maybe you have a clue on why running an embedded interpreter works with 3.3 but not 3.3<br>
<br>
Thanks,<br>
Serge<br>
<br>
<br>
From: Serge WEINSTOCK<br>
Sent: 19 August 2014 17:45<br>
To: '<a href="mailto:pythondotnet@python.org" target="_blank">pythondotnet@python.org</a>'<br>
Subject: RE: [Python.NET] Running an embedded interpreter<br>
<br>
Hi Tony,<br>
<br>
I’ve tried your suggestion but it doesn’t work.<br>
<br>
The issue seems to be more “fundamental” as the import of the .Net System assembly doesn’t work.<br>
<br>
Serge<br>
<br>
From: pythondotnet-bounces+serge.weinstock=<a href="mailto:uk.bnpparibas.com@python.org" target="_blank">uk.bnpparibas.com@python.org</a> [mailto:<a href="mailto:pythondotnet-bounces%2Bserge.weinstock" target="_blank">pythondotnet-bounces+serge.weinstock</a>=<a href="mailto:uk.bnpparibas.com@python.org" target="_blank">uk.bnpparibas.com@python.org</a>]<br>
Sent: 19 August 2014 17:16<br>
To: <a href="mailto:pythondotnet@python.org" target="_blank">pythondotnet@python.org</a><br>
Subject: Re: [Python.NET] Running an embedded interpreter<br>
Hi Serge,<br>
<br>
'mbcs' is what python uses to mean the current configured encoding. I would guess that the encoding of sys.stdout is different when using visual studio output console than the console.<br>
<br>
You could try a different encoding method by setting the PYTHONIOENCODING environment variable before starting your exe, eg:<br>
SET PYTHONIOENCODING=utf-8:ignore<br>
<br>
Look for PYTHONIOENCODING here <a href="https://docs.python.org/3/using/cmdline.html" target="_blank">https://docs.python.org/3/using/cmdline.html</a> for more details.<br>
<br>
Tony<br>
<br>
<br>
<br>
On Tue, Aug 19, 2014 at 2:22 PM, Serge WEINSTOCK <<a href="mailto:serge.weinstock@uk.bnpparibas.com" target="_blank">serge.weinstock@uk.bnpparibas.com</a>> wrote:<br>
Hi,<br>
 <br>
I’m trying to use Python3.2 using the Python.Net version found at: <a href="https://github.com/renshawbay/pythonnet" target="_blank">
https://github.com/renshawbay/pythonnet</a><br>
 <br>
I’m using the following simple test program:<br>
 <br>
//=======================================================================<br>
using System;<br>
using System.IO;<br>
using Python.Runtime;<br>
 <br>
namespace TestPythonNet<br>
{<br>
    class Program<br>
    {<br>
        static void Main(string[] args)<br>
        {<br>
            string binDir = Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(Program)).Location);<br>
            string pyHome = @"D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime";<br>
            PythonEngine.PythonHome = @"D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime";<br>
            PythonEngine.ProgramName = "PythonRuntime";<br>
            Environment.SetEnvironmentVariable("PYTHONPATH",<br>
                Path.GetFullPath(Path.Combine(pyHome, "DLLs")) + ";" +<br>
                Path.GetFullPath(Path.Combine(pyHome, "Lib")) + ";" +<br>
                Path.GetFullPath(Path.Combine(pyHome, "Lib", "site-packages")) + ";" +<br>
                binDir<br>
                );<br>
            Environment.SetEnvironmentVariable("PYTHONVERBOSE", "1");<br>
            PythonEngine.Initialize();<br>
            PythonEngine.ImportModule("clr");<br>
            using (Py.GIL())<br>
            {<br>
                PythonEngine.RunSimpleString(<br>
                    "import clr; " +<br>
                   "a = clr.AddReference('System'); " +<br>
                    "print(a.Location);" +<br>
                    "from System import Environment;" +<br>
                    "print(Environment.MachineName);");<br>
            }<br>
        }<br>
    }<br>
}<br>
//=======================================================================<br>
 <br>
“D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime” is a folder where I’ve copied the DLLs and Lib folder from a python 3.2 x86 distribution.<br>
 <br>
 <br>
When I run it from Visual Studio it works fine (I guess it may be related to the fact that I’m using python tools for Visual Studio).<br>
 <br>
But when I run it from the console, it fails with the output:<br>
 <br>
//=======================================================================<br>
Traceback (most recent call last):<br>
  File "D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime\Lib\site.py", line 481, in execsitecustomize<br>
    import sitecustomize<br>
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character<br>
Traceback (most recent call last):<br>
  File "D:\src\scratch\TestPythonNet\TestPythonNet\PythonRuntime\Lib\site.py", line 497, in execusercustomize<br>
    import usercustomize<br>
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character<br>
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll<br>
Traceback (most recent call last):<br>
  File "<string>", line 1, in <module><br>
UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character<br>
//=======================================================================<br>
 <br>
The “print(a.Location);" works but not the “from System import Environment”. There are also all these errors about mbcs.<br>
 <br>
Any idea on what I’m doing wrong?<br>
 <br>
Thanks,<br>
Serge Weinstock<br>
 <br>
<br>
___________________________________________________________<br>
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution
 of the material in this e-mail is prohibited.<br>
Please refer to <a href="http://www.bnpparibas.co.uk/en/email-disclaimer/" target="_blank">
http://www.bnpparibas.co.uk/en/email-disclaimer/</a> for additional disclosures.<br>
<br>
_________________________________________________<br>
Python.NET mailing list - <a href="mailto:PythonDotNet@python.org" target="_blank">
PythonDotNet@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pythondotnet" target="_blank">https://mail.python.org/mailman/listinfo/pythondotnet</a><br>
<br>
<br>
___________________________________________________________<br>
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution
 of the material in this e-mail is prohibited.<br>
<br>
Please refer to <a href="http://www.bnpparibas.co.uk/en/email-disclaimer/" target="_blank">
http://www.bnpparibas.co.uk/en/email-disclaimer/</a> for additional disclosures.<br>
_________________________________________________<br>
Python.NET mailing list - <a href="mailto:PythonDotNet@python.org" target="_blank">
PythonDotNet@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pythondotnet" target="_blank">https://mail.python.org/mailman/listinfo/pythondotnet</a><br>
<br>
<br>
___________________________________________________________<br>
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution
 of the material in this e-mail is prohibited.<br>
<br>
Please refer to <a href="http://www.bnpparibas.co.uk/en/email-disclaimer/" target="_blank">
http://www.bnpparibas.co.uk/en/email-disclaimer/</a> for additional disclosures.<br>
_________________________________________________<br>
Python.NET mailing list - <a href="mailto:PythonDotNet@python.org" target="_blank">
PythonDotNet@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pythondotnet" target="_blank">https://mail.python.org/mailman/listinfo/pythondotnet</a><o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p><br>
___________________________________________________________<br>
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution
 of the material in this e-mail is prohibited.<o:p></o:p></p>
<p>Please refer to <a href="http://www.bnpparibas.co.uk/en/email-disclaimer/" target="_blank">
http://www.bnpparibas.co.uk/en/email-disclaimer/</a> for additional disclosures.<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><br>
_________________________________________________<br>
Python.NET mailing list - <a href="mailto:PythonDotNet@python.org">PythonDotNet@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/pythondotnet" target="_blank">https://mail.python.org/mailman/listinfo/pythondotnet</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p><br>
___________________________________________________________<br>
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.</p>

<p>Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional disclosures.</p></body>
</html>