C
C#2y ago
Tobirama

❔ Python in C#

Where i can find MS Scripting assembly for IronPython
13 Replies
reflectronic
reflectronic2y ago
IronPython 3.4.0
IronPython is an open-source implementation of the Python programming language that is tightly integrated with the .NET Framework. IronPython can use the .NET Framework and Python libraries, and other .NET languages can use Python code just as easily. This package contains the IronPython interpreter engine.
reflectronic
reflectronic2y ago
you want to host IronPython in your .NET app? that’s the package you want, then
Tobirama
Tobirama2y ago
i know but but it tells me that I am missing an assembly
reflectronic
reflectronic2y ago
oh, i see that shouldn’t be happening… can you show me what your .csproj file looks like but, also, if you just want to do text-to-speech, you don’t need IronPython there are built in .NET functions that do it for you
Tobirama
Tobirama2y ago
yes there is the google api but it is paying
reflectronic
reflectronic2y ago
no, not the google one
Tobirama
Tobirama2y ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;



namespace Text_2_Speech
{
public partial class Form1 : Form
{


public Form1()
{
InitializeComponent();

}

private void Exit_Button_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void Reduire_Button_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}

private void StartToSpeechButton_Click(object sender, EventArgs e)
{
var engine = Python.CreateEngine();
var scope = engine.CreateScope();
engine.Execute("from gtts import gTTS", scope);
engine.Execute("tts = gTTS(\"Test\", lang='en', slow=False)", scope);
engine.Execute("tts.save(\"Test.mp3\")", scope);
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;



namespace Text_2_Speech
{
public partial class Form1 : Form
{


public Form1()
{
InitializeComponent();

}

private void Exit_Button_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void Reduire_Button_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}

private void StartToSpeechButton_Click(object sender, EventArgs e)
{
var engine = Python.CreateEngine();
var scope = engine.CreateScope();
engine.Execute("from gtts import gTTS", scope);
engine.Execute("tts = gTTS(\"Test\", lang='en', slow=False)", scope);
engine.Execute("tts.save(\"Test.mp3\")", scope);
}

private void Form1_Load(object sender, EventArgs e)
{

}
}
}
reflectronic
reflectronic2y ago
it’s built into windows, free and everything
Tobirama
Tobirama2y ago
hmm thank 👍
reflectronic
reflectronic2y ago
the example on the page should be enough to get you started if it’s not showing up, you need to add a reference to System.Speech in the add reference page
Tobirama
Tobirama2y ago
its good thanks
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts