🎅 Christmas Udemy Cupons 🎅 Ends in 1 day! 89% OFF! 🎁 Python Docx from Beginner to Winner 🎅 www.udemy.com/course/python-docx-from-beginner-to-winner/?couponCode=DECEMBER_19_22 🎁 Python PDF Handling from Beginner to Winner 2023 🎅 www.udemy.com/course/python-pdf-handling-from-beginner-to-winner/?couponCode=DECEMBER_19_22 🎁 Python TkInter from Beginner to Winner 2023 🎅 www.udemy.com/course/python-tkinter-from-beginner-to-winner/?couponCode=DECEMBER_19_22 🎁 Python ReportLab from Beginner to Winner 2023 🎅 www.udemy.com/course/python-reportlab-from-beginner-to-winner/?couponCode=DECEMBER_19_22 🎅 Cupons de Natal 🎅 Termina em 1 dia! 89% de desconto! 🎁 Python Docx de Iniciante a Vencedor 🎅 www.udemy.com/course/python-docx-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22 🎁 Python Manipulação de PDF de Iniciante a Vencedor 2023 🎅 www.udemy.com/course/python-manipulacao-de-pdf-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22 🎁 Python TkInter de Iniciante a Vencedor 2023 🎅 www.udemy.com/course/python-tkinter-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22 🎁 Gerando Arquivos PDF com Python e ReportLab 2023 🎅 www.udemy.com/course/gerando-arquivos-pdf-com-python-e-reportlab/?couponCode=DECEMBER_19_22 🎁 Python ReportLab de Iniciante a Vencedor 2023 🎅 www.udemy.com/course/python-reportlab-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22
Thank you so much. I was stuck because I wanted to use my python function .Net. I was hunting for libraries to achieve this but your video made it so simple
Hi ! please help ! my code throws an exception " No module named '__future__' " And I checked but there's a future file both in my python path lib and in ironpython lib .
Hi @AllTech , Thanks for your nice teaching. I have a question. My C# project is a WPF project instead of a windows command project. So i create a button on the wpf project and bind it with the function. I hope when user click the button, it will execute the script. Now i am using your method 1 to run python script. But there will no cmd window show up. And i also find the python script doesn't work.
Hi Sunil, Did you find any way to do this? Adding other python libraries like cv2, moviepy etc... I am getting some error like microsoft.scripting.syntaxerrorexception 'unexpected token 'from'' and could not find any help online 😒
After a bunch of useless tries and research, some stuff just told that IronPython is not able to import another Python libs, just native code. And there was an advise to use Python Net instead. Have a good luck, you'll need each drop of it.
You're welcome Phi Bui! Also i have this mix of tutorials: Python cool tutorials: ua-cam.com/play/PLOGAj7tCqHx8UnbicOV7iI-ogWeMmkqyu.html what do you think? 😃
Hello I will receive a hardware which has native Python API to communicate through USB. Can I embed this in C# application and communicate through it? So in my case the Python engine should receive data from USB port and transfer it to C# or send data to USB device from C# to Python and then to the device. Is that also possible?
Hello, well the first option is like running on the cmd...but instead being a human typing the commands is the software. It should work as well :) Thank you Yuan :)
This is a nice tutorial but how to you get input? i want to get input from python and add the result... ima try change the "Open in new window to true" thing so yea.. please help
hi, when using IronPython it is not ok to using compiled py libs such as numpy or pandas. Moreover, ironpython development work was stopped in 2012 or earlier. I think you may try pythonnet instead which could run under NET core 2 or 3.1
Hello, I'm using your tutorial to launch Machine Learning programs by using the first method (I need Python 3). I would like to know if it was possible to retrieve the output variables of the python script. If so, I would like to have the method and an example to illustrate this. Thank you very much.
Hello Klop :) Well the first method will return a string. What you can do is...in python side convert object into a json string. And in the C# side you have to convert the returned json string (from python) into an object. :) Object to JSON String in Python? www.w3schools.com/python/python_json.asp JSON String to Object in C#? stackoverflow.com/questions/4611031/convert-json-string-to-c-sharp-object Hope this helps you ^.^
Hi@@AllTechPage here is an example : WARNING: d:\build\xgboost\xgboost-0.90.git\src\objective egression_obj.cu:152: reg:linear is now deprecated in favor of reg:squarederror.
@@AllTechPage Oh... I see... according to what I heard, they will release their Python 3 version soon... maybe, it's still alive... I like to use Iron Python for game development....
Iron python gives you more control but limits you to python 2 syntax...running from a process, you have limitations because you need to pass parameters and receive the result from strings, but you can use python 3. There is no perfect solution :)
Uhm in that case to use iron python you need to adapt your script to Python 2 syntax. Using the process option has limitations with input parameters and output. Try to test a small script first and see if it is what you wanted :)
Hello AllTech, I have a question uhmm i have create machine learning image recognizer using python and tensorflow library, now i instead of running it on command line and typing this following command "python scripts/label_image.py --image test.jpg" i want it to send via c# windows form. Im not actually going to display my pyhton file im just going to send a scripts that will give me back the result and i want that result to display on c# application.
Hello Lester, I'm sorry I didn't understood the question fully... In the video I'm showing 2 ways to run a script, calling it from a windows process or using IronPython and of course both options have advantages/disavantages. IronPython give you a better control over what you can do with the python script results and also allows you to access script variables from c# but (at least for now) it requires a python 2 version of the code...in the other hand calling it from a win process allows you to use the python interpreter that you have installed on your machine (so you don't need to do script adaptations) but you have to deal with a string in the c# side as the python script result which means that you need to make a string with a pattern for you to deal with it in the c# side and shape the values for your c# objects and variables (it's nothing undoable! web technologies are based on that principal and do it all the time...but it will give you some work)... Resume: IronPython, will be a pain if you don't have the code in python 2..you need to think more. Win Process, will be a pain formatting the result string for communication from python to c#..gives you more work but you don't have to think much. You also can run the script from SQL Server...can it be an option for you? ua-cam.com/play/PLOGAj7tCqHx9Add6MWzl_5Wbix9V1OjSx.html
@@AllTechPage i will clarify my question, uhmm okay so this is what i really mean, i have a image recognizer, create using python codes and my problem is i dont have a good user interface on it , and i found out that a python script can be called using c# application, For example i will recognize a bird using my python codes. Before recognizing it, i will still need to write a short python scripts to start recognizing that particular image. What i want on c# application is ,i will have a picturebox and a button named recognize and when i click it, it will start recognizing what's the image inside the picturebox. I'm not really good with english, hope you understand what i said. Thank you
@@AllTechPage Actually ran into a problem, maybe you can help. I'd like my Python script to return a list to C# and not a string. Would this be possible?
Hello again Stef, you can convert the list in python into json string and in c# side convert from json string into objects. An example: # python side import json # dictionary _dictionary = { "name": "Jordan", "age": 30 } # list _list = ['a', 'b', 'c'] _json = json.dumps(_dictionary) print(_json) # {"name": "Jordan", "age": 30} _json = json.dumps(_list) print(_json) # ["a", "b", "c"] // c# side using System.Web.Script.Serialization; var jsonSer = new JavaScriptSerializer(); var jsonStr = ""; jsonStr = "{\"name\": \"Jordan\", \"age\": 30}"; var _dictionary = jsonSer.Deserialize(jsonStr); jsonStr = "[\"a\", \"b\", \"c\"]"; var _list = jsonSer.Deserialize(jsonStr); Console.WriteLine(_dictionary["age"]); Console.WriteLine(_list[1]); Hope this helps :)
but what if I want to be able to talk back and forth with the script? c# runs comunication.py py: Hi nice to meet you what's your name? c#: its csharp py: Hey csharp, I wanna ask you a potentially personal question c#: ok go ahead py: what's your favorite color? c#: It's blue whats yours py: purple! py: thanks for your time ;) c#: :)
Hello AllTeh! string str(byte[] x) => Encoding.Default.GetString(x); this line give me error. i'm using Visual Studio 2015 is there any problem with " VS 2015" or i need to install any kind of new packages from NuGet package to run C# 7 code. Please let me know what should i do.
Thank you it works ! I only watch a half,it solves my problem,what's more I can use opencv in it as well .Previously I use ScriptRuntime pyRuntime = Py.CreateRuntime(); eng = IronPython.Hosting.Python.CreateEngine() .It always Crash ! due to compatible issue. I wonder if it depends on IronPython I use anaconda
Hello and thank you for the tutorial, I've diff. question for you. I've an exe ( tbh its a game and using python ) and its using python functions. How can I call them from my project?
Hi, thank you for this great video! I'm having a problem, when trying method 1 I got an ModuleNotFoundError for some packages that I'm importing in my script. How could I fix that? (I'm having problems importing my own files and another libraries as pdf2image). PS: I've tried method 2 but I got errors even importing os
Good tutorial. Next time please don't record every single word in your sentence seperately. You cannot recognize when a sentence starts and when it ends.
Thank youuuu Chris!!! Now I'm making these new series: Python Multiple Choices # Season 01 # for Beginners: ua-cam.com/play/PLOGAj7tCqHx-lll9SkuU8ue_NaCIKN9pG.html what do you think about those?
Well I think you can do it: 1 - using IronPython like I show in the video - to call python functions 2 - in python side, you should learn how to connect and interact with SQLite (using python 2 because it is a limitation of IronPython)...it should be very similar to what you can see in this video: ua-cam.com/video/aF552bMEcO4/v-deo.html - NOTE this video is for SQL Server, not SQLite and also it is in Python 3. Hope this helps :)
2022: ironpython is no longer maintained, it is better to use option 1 and compile the scripts with pyinstaller to generate an exe and be able to execute it without having Python installed on the PC, since the compilation creates the necessary files and libraries.
Hi Alltech, I tried both the approch to call python scripts from C# and none of them worked... My python scripts have imported numpy, cv2 and moviepy libraries... I ended up with this error when I tried using Ironpython method - microsoft.scripting.syntaxerrorexception 'unexpected token 'from''.... Please let me what can be done for, if you could try and let us know how to make it work it will be of great helpful and much appreciated....
Hi I am using first method when I run the code it is working fine but when I hosted the code on my local machine (IIS) it does not work.Please give me some ideas.
Hello Shubham, I believe it can be permissions problem. Must give permissions to your app to run external code, something like that. Hope this helps you Shubham :)
hello, i am executing the Exec_process option and i am encountering the Exception as "Access Denied' for the psi Start(). i have also manually given all the permissions still the error pesists. Can you help please.
@@AllTechPage Thank You for Replying !! Yes They Both are in C Drive and i am getting this error "System.ComponentModel.Win32Exception: 'Access is denied'"
Hi, This is a very great video, I have one question, And I am calling this sentiment.py from C#, I am getting this error. "No module named textblob" In python application sentiment.py from textblob import TextBlob def test_func(): name="Today is a good day for a picnic." blob = TextBlob(name) polarity = blob.sentiment.polarity print(polarity) print(blob.sentiment) And I am calling this sentiment.py from C#, I am getting this error. "No module named textblob" I am very hopeful.
Nice video. But can you give us the python script you used? I am trying to this but in windows forms. I want to plot some graphs with python and display them in my windows forms app, but I still have some questions about how to make the script in python in order to work. So can you please give me the script?
Hello, I tried the first option with VS2012 and faced this issue: Unexpected character '$' with this line code: psi.Arguments = $"\"{script}\"\"{start}\"\"{end}\""; besides, I faced an error with opening python file [Errno 22] Invalid argument
@@AllTechPage Do you have any similar examples? infact, I'm trying to excute Excel tasks via python script and display the output on User interface designed by Visual Studio
I was also facing the same issue . resolved the error below ,look at the below code .. psi.FileName = "C:\\python39\\python.exe"; //provide script and arguments var script = @"C:\\python39\\test1.py"; var start = "2019-1-1"; var end = "2019-1-22"; psi.Arguments = string.Concat(script, " ", start.ToString(), " ", end.ToString());
hi, i have went with the first option , am facing this error : System.ComponentModel.Win32Exception (5): Access is denied python version = 3.6, windows 10, .net core 2 project . kindly suggest me the solution
Hello That error suggests that the program you wrote don't have enough security permissions to access something...you're trying to access a folder or file in another location?
🎅 Christmas Udemy Cupons 🎅 Ends in 1 day! 89% OFF!
🎁 Python Docx from Beginner to Winner 🎅 www.udemy.com/course/python-docx-from-beginner-to-winner/?couponCode=DECEMBER_19_22
🎁 Python PDF Handling from Beginner to Winner 2023 🎅 www.udemy.com/course/python-pdf-handling-from-beginner-to-winner/?couponCode=DECEMBER_19_22
🎁 Python TkInter from Beginner to Winner 2023 🎅 www.udemy.com/course/python-tkinter-from-beginner-to-winner/?couponCode=DECEMBER_19_22
🎁 Python ReportLab from Beginner to Winner 2023 🎅 www.udemy.com/course/python-reportlab-from-beginner-to-winner/?couponCode=DECEMBER_19_22
🎅 Cupons de Natal 🎅 Termina em 1 dia! 89% de desconto!
🎁 Python Docx de Iniciante a Vencedor 🎅 www.udemy.com/course/python-docx-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22
🎁 Python Manipulação de PDF de Iniciante a Vencedor 2023 🎅 www.udemy.com/course/python-manipulacao-de-pdf-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22
🎁 Python TkInter de Iniciante a Vencedor 2023 🎅 www.udemy.com/course/python-tkinter-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22
🎁 Gerando Arquivos PDF com Python e ReportLab 2023 🎅 www.udemy.com/course/gerando-arquivos-pdf-com-python-e-reportlab/?couponCode=DECEMBER_19_22
🎁 Python ReportLab de Iniciante a Vencedor 2023 🎅 www.udemy.com/course/python-reportlab-de-iniciante-a-vencedor/?couponCode=DECEMBER_19_22
For people having errors about module import, I'm on mac and I fixed it by using @"/usr/bin/python3" instead of @"/usr/bin/python". I hope this helps!
Worked like a charm. I used it with MVC and it worked.. cool tutorial.. saved me hours of research
Thank you so much. I was stuck because I wanted to use my python function .Net. I was hunting for libraries to achieve this but your video made it so simple
Sir, Thanks for the code, in my project I want modules in iron python so how can I install it ???
Excellent. Very well organized. Hated the pasta wallpaper--it is distracting, and it bled through the first line of your slides.
Thanks for this and also answering questions - that is rare these days.
Thank you ^.^
Hi ! please help ! my code throws an exception " No module named '__future__' " And I checked but there's a future file both in my python path lib and in ironpython lib .
@@FLUMBARDING i think that ironpython only supports the standard lib
Thank you so much Dude, it's so useful for me!!!
Thanks for posting, you save my time!!
You're welcome Ray :)
Hi @AllTech , Thanks for your nice teaching. I have a question. My C# project is a WPF project instead of a windows command project. So i create a button on the wpf project and bind it with the function. I hope when user click the button, it will execute the script. Now i am using your method 1 to run python script. But there will no cmd window show up. And i also find the python script doesn't work.
How do you add other python libraries such as NumPy, cv2, and etc?
Is there any update regarding adding python libraries?
Hi Sunil, Did you find any way to do this? Adding other python libraries like cv2, moviepy etc... I am getting some error like microsoft.scripting.syntaxerrorexception 'unexpected token 'from'' and could not find any help online 😒
@@chetansudeep2011 No, I give up after several hours of researching. I really don't think there is a way to add other libraries.
After a bunch of useless tries and research, some stuff just told that IronPython is not able to import another Python libs, just native code. And there was an advise to use Python Net instead. Have a good luck, you'll need each drop of it.
But if you have the dependencies installed in your python, refeering to the .exe works, this worked for me and i needed the arcpy dependecy
so useful. helped me. Thank you very much.
you're welcome Armin 😃
Thanks for posting
thank you this is very helpfull video but i am getting error like "no module named warnings" please help me with that
Did you solve your problem?
Thank you very much! That was very helpful.
it's good to know it helped Nathan 😊
thank you so much. video is very detail.
You're welcome Phi Bui!
Also i have this mix of tutorials: Python cool tutorials: ua-cam.com/play/PLOGAj7tCqHx8UnbicOV7iI-ogWeMmkqyu.html
what do you think? 😃
Great Tutorial!
Great quick overview, thanks for posting!
Thank you very much Matt :)
Hello I will receive a hardware which has native Python API to communicate through USB. Can I embed this in C# application and communicate through it? So in my case the Python engine should receive data from USB port and transfer it to C# or send data to USB device from C# to Python and then to the device. Is that also possible?
Lovely tutorial ... worked like a charm!! Thanks a lot.
You're welcome Sandeep 😃
thanks a lot for the tutorial!
does the first option also support CPython libraries such as numpy and scipy?
Hello, well the first option is like running on the cmd...but instead being a human typing the commands is the software. It should work as well :)
Thank you Yuan :)
@@AllTechPage i was just thinking about how to pass the arguments... will give it a try anyway. thanks!
@@yuanfang2352 Could you do that? :0
This is a nice tutorial but how to you get input? i want to get input from python and add the result... ima try change the "Open in new window to true" thing so yea.. please help
helpful. Thank you.
You're welcome Rabbani :)
Great tutorial. Thanks
Thank you Luan :)
Thanks dear AllTech
Thank you very much :)
amazing tutorial
Thank you :)
Thanks a lot bro!
you're welcome 😁
Why is the background of the slideshow a deep fried image of macaroni? Good tutorial though!
Ehehe because i like it :')))
Thank you :)
this great works, but fail when complex script with import module, anybody same problem ? and how solved it ? thx
Thank you sir
thanks you, you save the day!
^.^ i'm glad this helped, you're welcome :)
Hey, if you could help me. How to import external libraries like numpy and pandas in ironpython.
Sorry I never tried that :/
Maybe in a future video I'll try it
check this out ua-cam.com/video/9D8TXQkO948/v-deo.html
@@NgoniAlwin Hi, were you able to import numpy/scipy libraries?
And run them from Unity editor?
hi, when using IronPython it is not ok to using compiled py libs such as numpy or pandas. Moreover, ironpython development work was stopped in 2012 or earlier. I think you may try pythonnet instead which could run under NET core 2 or 3.1
Hello,
I'm using your tutorial to launch Machine Learning programs by using the first method (I need Python 3). I would like to know if it was possible to retrieve the output variables of the python script. If so, I would like to have the method and an example to illustrate this.
Thank you very much.
Hello Klop :)
Well the first method will return a string. What you can do is...in python side convert object into a json string. And in the C# side you have to convert the returned json string (from python) into an object. :)
Object to JSON String in Python?
www.w3schools.com/python/python_json.asp
JSON String to Object in C#?
stackoverflow.com/questions/4611031/convert-json-string-to-c-sharp-object
Hope this helps you ^.^
@@AllTechPage thank you very much I will try it tomorrow. I hope it will work
Hi All Tech,
Your trick worked but I needed to get rid of the warnings. Do you know how to do it automatically in C#?
Hello Klop, what kind of warnings do you have?
Hi@@AllTechPage here is an example : WARNING: d:\build\xgboost\xgboost-0.90.git\src\objective
egression_obj.cu:152: reg:linear is now deprecated in favor of reg:squarederror.
Thank you very much for this great tutorial!
you're very welcome Mr. Tech Guy 🙌😊🎉
@@AllTechPage
(^__^)
Btw, are there other Iron Python tutorials on your channel?
Thank you again in advance!
no, this is the only one.. i think ironpython is dying... i want to do one about python .net but didn't found enough time to make it yet :/
@@AllTechPage
Oh... I see... according to what I heard, they will release their Python 3 version soon... maybe, it's still alive... I like to use Iron Python for game development....
oh I didn't knew that!!! ok maybe I'll explore that one in the near future eheheh
What font is this . Its gorgeus.
Hello, do i need to make any changes in the code if i am not passing any arguments.
How is possible to run python script in C# that has imported libraries inside the script ?
Python 3 I use. Is version 3 still not working with Unity?
Thanks very Much ,
Which one is better ? Plz suggest
Iron python gives you more control but limits you to python 2 syntax...running from a process, you have limitations because you need to pass parameters and receive the result from strings, but you can use python 3.
There is no perfect solution :)
@@AllTechPage i am using python3. so can i use Iron Pytnon or it is better than process
Uhm in that case to use iron python you need to adapt your script to Python 2 syntax.
Using the process option has limitations with input parameters and output.
Try to test a small script first and see if it is what you wanted :)
Can iron python run python3 scripts?
I get an error in source.Execute(scope) saying " No module named 'datetime' "
Hello AllTech, I have a question uhmm i have create machine learning image recognizer using python and tensorflow library, now i instead of running it on command line and typing this following command "python scripts/label_image.py --image test.jpg" i want it to send via c# windows form. Im not actually going to display my pyhton file im just going to send a scripts that will give me back the result and i want that result to display on c# application.
Hello Lester, I'm sorry I didn't understood the question fully...
In the video I'm showing 2 ways to run a script, calling it from a windows process or using IronPython and of course both options have advantages/disavantages. IronPython give you a better control over what you can do with the python script results and also allows you to access script variables from c# but (at least for now) it requires a python 2 version of the code...in the other hand calling it from a win process allows you to use the python interpreter that you have installed on your machine (so you don't need to do script adaptations) but you have to deal with a string in the c# side as the python script result which means that you need to make a string with a pattern for you to deal with it in the c# side and shape the values for your c# objects and variables (it's nothing undoable! web technologies are based on that principal and do it all the time...but it will give you some work)...
Resume:
IronPython, will be a pain if you don't have the code in python 2..you need to think more.
Win Process, will be a pain formatting the result string for communication from python to c#..gives you more work but you don't have to think much.
You also can run the script from SQL Server...can it be an option for you?
ua-cam.com/play/PLOGAj7tCqHx9Add6MWzl_5Wbix9V1OjSx.html
@@AllTechPage thank you for your quick respond
@@AllTechPage i will clarify my question, uhmm okay so this is what i really mean, i have a image recognizer, create using python codes and my problem is i dont have a good user interface on it , and i found out that a python script can be called using c# application, For example i will recognize a bird using my python codes. Before recognizing it, i will still need to write a short python scripts to start recognizing that particular image. What i want on c# application is ,i will have a picturebox and a button named recognize and when i click it, it will start recognizing what's the image inside the picturebox. I'm not really good with english, hope you understand what i said. Thank you
Super.
thank you 😊😊😊
thanks!
You're very welcome Stef ^.^
@@AllTechPage Actually ran into a problem, maybe you can help. I'd like my Python script to return a list to C# and not a string. Would this be possible?
Hello again Stef, you can convert the list in python into json string and in c# side convert from json string into objects.
An example:
# python side
import json
# dictionary
_dictionary = {
"name": "Jordan",
"age": 30
}
# list
_list = ['a', 'b', 'c']
_json = json.dumps(_dictionary)
print(_json) # {"name": "Jordan", "age": 30}
_json = json.dumps(_list)
print(_json) # ["a", "b", "c"]
// c# side
using System.Web.Script.Serialization;
var jsonSer = new JavaScriptSerializer();
var jsonStr = "";
jsonStr = "{\"name\": \"Jordan\", \"age\": 30}";
var _dictionary = jsonSer.Deserialize(jsonStr);
jsonStr = "[\"a\", \"b\", \"c\"]";
var _list = jsonSer.Deserialize(jsonStr);
Console.WriteLine(_dictionary["age"]);
Console.WriteLine(_list[1]);
Hope this helps :)
but what if I want to be able to talk back and forth with the script?
c# runs comunication.py
py: Hi nice to meet you what's your name?
c#: its csharp
py: Hey csharp, I wanna ask you a potentially personal question
c#: ok go ahead
py: what's your favorite color?
c#: It's blue whats yours
py: purple!
py: thanks for your time ;)
c#: :)
Dude, your'e one hell of a thinker!
Which version of python are you using?
Hello Samba,
The one from command line is 3...but like I say in the video, ironpython uses v2 sintax.
@@AllTechPage oh i havent listen it
Hello AllTeh!
string str(byte[] x) => Encoding.Default.GetString(x); this line give me error.
i'm using Visual Studio 2015 is there any problem with " VS 2015" or i need to install any kind of new packages from NuGet package to run C# 7 code. Please let me know what should i do.
Thank you it works ! I only watch a half,it solves my problem,what's more I can use opencv in it as well .Previously I use ScriptRuntime pyRuntime = Py.CreateRuntime(); eng = IronPython.Hosting.Python.CreateEngine() .It always Crash ! due to compatible issue. I wonder if it depends on IronPython I use anaconda
Hello and thank you for the tutorial, I've diff. question for you. I've an exe ( tbh its a game and using python ) and its using python functions. How can I call them from my project?
Hey Ducka's how are you?
I didn't fully understood your question, it's an external exe?
@@AllTechPage nah, its a game and using python functions and I wanna code external c# project to call python functions
But it's not what I am doing in this video?
@@AllTechPage lemme watch it again and again till I understand
@@duckasprivate3040 you think the video is difficult to understand? I'm asking so I can see what I am doing wrong.
Hi, thank you for this great video! I'm having a problem, when trying method 1 I got an ModuleNotFoundError for some packages that I'm importing in my script. How could I fix that? (I'm having problems importing my own files and another libraries as pdf2image).
PS: I've tried method 2 but I got errors even importing os
Can I use this with unity? So for example, I have python script that will need values from a c# script and use that python script within unity ?
Hello Gianne,
I never tried...in theory it will work since you're coding in c#. It's the best answer that I can give you at the moment :)
dis it work for you ? Gianne Flores?? cos its throwing error in mine ..i too am trying to run python in c# unity
@@calmjey I also ran into an error and ended up doing something else! Sorry for not being much help
Good tutorial. Next time please don't record every single word in your sentence seperately. You cannot recognize when a sentence starts and when it ends.
Thank youuuu Chris!!!
Now I'm making these new series: Python Multiple Choices # Season 01 # for Beginners: ua-cam.com/play/PLOGAj7tCqHx-lll9SkuU8ue_NaCIKN9pG.html
what do you think about those?
Is it possible to create a project with C# for the frontend and Python (SQLite) for the backend?
Yes it is :)
@@AllTechPage would it be the same method you show on this video? or what else should I learn about?
Well I think you can do it:
1 - using IronPython like I show in the video - to call python functions
2 - in python side, you should learn how to connect and interact with SQLite (using python 2 because it is a limitation of IronPython)...it should be very similar to what you can see in this video: ua-cam.com/video/aF552bMEcO4/v-deo.html - NOTE this video is for SQL Server, not SQLite and also it is in Python 3.
Hope this helps :)
2022: ironpython is no longer maintained, it is better to use option 1 and compile the scripts with pyinstaller to generate an exe and be able to execute it without having Python installed on the PC, since the compilation creates the necessary files and libraries.
This looks like a great idea that solves many of the questions posed by others.
Hi Alltech, I tried both the approch to call python scripts from C# and none of them worked... My python scripts have imported numpy, cv2 and moviepy libraries... I ended up with this error when I tried using Ironpython method - microsoft.scripting.syntaxerrorexception 'unexpected token 'from''....
Please let me what can be done for, if you could try and let us know how to make it work it will be of great helpful and much appreciated....
hello are you solved this error now:/ if solved plz tell me:)
Hi I am using first method when I run the code it is working fine but when I hosted the code on my local machine (IIS) it does not work.Please give me some ideas.
Hello Shubham,
I believe it can be permissions problem. Must give permissions to your app to run external code, something like that.
Hope this helps you Shubham :)
@@AllTechPage Thank you so much for reply, but I already give all the permissions to my local folder as well as on IIS. But it is not working
Any error message?
@@AllTechPage No any error message. My API is running perfectly but it is not able to call "main.py" python file.
Can you do me a favor ? Can you please send me a video link in which you hosted your above code on IIS and run the same?
I went with the first method ang got this error :can't open file errno22 invalid argument
Hello Komal, how are you?
Can you show the command?
Hello Alexander,
Did you checked if the folder have security permissions?
Oh good to know :) you're welcome
Dose IronPython require Python Enviroments?
Add an environment variable? No.
I don't know if it was what you were trying to ask :D
hello,
i am executing the Exec_process option
and i am encountering the Exception as "Access Denied' for the psi Start().
i have also manually given all the permissions still the error pesists.
Can you help please.
Hello Atharva, I will try :)
The c# project and the script are in the same drive? They are in the same drive where windows is installed?
@@AllTechPage Thank You for Replying !! Yes They Both are in C Drive and i am getting this error "System.ComponentModel.Win32Exception: 'Access is denied'"
Do you needed to restart the computer after changing permissions?
@@AllTechPage umm it didn't ask me to restart my pc
Can you restart just to exclude that possibility?
Hi, This is a very great video, I have one question, And I am calling this sentiment.py from C#, I am getting this error. "No module named textblob"
In python application
sentiment.py
from textblob import TextBlob
def test_func():
name="Today is a good day for a picnic."
blob = TextBlob(name)
polarity = blob.sentiment.polarity
print(polarity)
print(blob.sentiment)
And I am calling this sentiment.py from C#, I am getting this error. "No module named textblob"
I am very hopeful.
Nice video. But can you give us the python script you used? I am trying to this but in windows forms. I want to plot some graphs with python and display them in my windows forms app, but I still have some questions about how to make the script in python in order to work. So can you please give me the script?
Hello, the link is in the description for download :)
@@AllTechPage Oh, sorry, I thought it is just CS script. Thanks
Congratulation
Hello, I tried the first option with VS2012 and faced this issue: Unexpected character '$'
with this line code: psi.Arguments = $"\"{script}\"\"{start}\"\"{end}\"";
besides, I faced an error with opening python file [Errno 22] Invalid argument
Hello :)
What is the C# version? Using string interpolation (the dollar sign) is a very recent feature.
@@AllTechPage Hi, I'm using C# version 2012
I think that feature is not available yet in 2012. You have to do it by concatenation or using the String.Format method to do the same job. :)
@@AllTechPage Do you have any similar examples? infact, I'm trying to excute Excel tasks via python script and display the output on User interface designed by Visual Studio
I was also facing the same issue .
resolved the error below ,look at the below code ..
psi.FileName = "C:\\python39\\python.exe";
//provide script and arguments
var script = @"C:\\python39\\test1.py";
var start = "2019-1-1";
var end = "2019-1-22";
psi.Arguments = string.Concat(script, " ", start.ToString(), " ", end.ToString());
hi, i have went with the first option , am facing this error : System.ComponentModel.Win32Exception (5): Access is denied
python version = 3.6,
windows 10,
.net core 2 project .
kindly suggest me the solution
Hello
That error suggests that the program you wrote don't have enough security permissions to access something...you're trying to access a folder or file in another location?
@@AllTechPage thanks, now its works fine
I'm happy to know it worked ^.^
How do you do this on a Mac
Sorry Kaushal I don't have a Mac so I never tried that :/
Iron Python doesn't support request file?
Hello, what do you mean? Or what you are trying to do?
How to run a python script from the ressources? Exemple:
Script: Accueil.py
logicielname.Properties.Resources.Accueil
Isn't good...
Interesting video. Could you please share the location of the source code?*
Hello and thank you :)
The link for download is in the description of this video :)
Why does it look deepfried
cuz I'm deepfried too :D....kidding...
or not...
sauce?
This is a javascript guy for fricks sake
I'm sure it's a good tutorial but I just can't handle the monotonous and choppy way you talk. Your video just wasn't for me.