Skip to content
Advertisement

Python.net is not receiving correct encoded string from .net

I am using .net 4.7.1 console program talking to python.net that VS2017 is reporting as version 2.5.1.0 (runtime version v4.0.30319) Python code is in 3.6

python:

JavaScript

dot net :

JavaScript

The python stand alone run reports:

JavaScript

Dot net run reports:

JavaScript

Notice the True in python vs the False when calling from C# The special characters in headervalid() from dot net don’t seem to be going over correctly. What should I do to fix this? Any ideas greatly appreciated!

Advertisement

Answer

Putting ‘@’ character in front of C# string turns it into a raw string, meaning no escape sequences inside will work.

You can see that by adding Console.WriteLine(input); to your code.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement