Good Day!~~
Thanks for your fast reply.
So there is _ssl module in IronPython, but no ssl module, and I need to find a 
standard library to call _ssl module, am I right?
C has stdlib module so I can do such as <include stdlib>, but seems there is no 
module called stdlib in IronPython.(Import error again >.<) 
Can you be more specific about Python stdlib(standard library) which has ssl 
module to call _ssl?
Or could you tell me how to use Python "ssl.py" (I found it under Python/lib 
folder) to let things work if this is the one I needed.
Thank you very much ^ ^
KayDate: Mon, 12 Dec 2011 12:58:51 -0700
Subject: Re: [Ironpython-users] Visual studio C# "no module named ssl" import 
error
From: slide.o....@gmail.com
To: waitmefore...@hotmail.com
CC: ironpython-users@python.org

socket is provided via IronPython.Modules, but only _ssl (the "native" module) 
is implemented in IronPython.Modules. You would need the Python stdlib which 
has the ssl module (which uses _ssl).

Thanks,
slide

2011/12/12 楊 鈞凱 <waitmefore...@hotmail.com>






Hello Everyone, I want to use Ironpython to call a simple ssl socket test 
program

but I got a ImportException error called "no module named ssl".

Strange thing is I can import socket and run as "import socket".(tested with 
another simple socket program without ssl)

But I cant import ssl as "import ssl" and got a big error, Any tips?
My code in c# to call python:

using System;using System.Collections.Generic;using System.ComponentModel;using 
System.Data;using System.Drawing;
using System.Linq;using System.Text;using System.Windows.Forms;
using IronPython.Hosting;using Microsoft.Scripting.Hosting;
namespace test
{    public partial class Form1
  : Form    {        public Form1()        {            InitializeComponent();  
      }
        private void button1_Click(object sender, EventArgs e)
        {            ScriptRuntime pyRuntime = Python.CreateRuntime();
            dynamic obj = pyRuntime.UseFile("sslsocket.py");
            string response = obj.openssl("hello");

            if (response == "true")                MessageBox.Show("success", 
"success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

  &nbs
 p;         this.Close();        }}
And the sslsocket.py code is:
import socketimport ssl
def openssl(data):
        HOST = '192.168.1.6'    PORT = 1234     d = data.encode('utf-8')
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)   ssl_sock = 
ssl.wrap_socket(s,ca_certs="C:\Users\test\Documents\Visual Studio 
2008\Projects\testupload\root.crt",cert_reqs=ssl.CERT_NONE)
        ssl_sock.connect((HOST, PORT))  ssl_sock.send(d)        ssl_sock.close()
        return "true"
Platform: Win7 32 bit, Python 2.7, Visual studio 2010, IronPython 2.7.1(latest 
one)                                       
                                          

_______________________________________________

Ironpython-users mailing list

Ironpython-users@python.org

http://mail.python.org/mailman/listinfo/ironpython-users




-- 
Website: http://earl-of-code.com

                                                                                
  
_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to