The "random" module was not found when creating .exe from IronPython 2.6 script

I am using SharpDevelop to create an executable from my IronPython script. The only problem is that my script has a random import line which works fine when running the script through ipy.exe, but when I try to create and run exe from the script in SharpDevelop, I always get the message:

IronPython.Runtime.Exceptions.ImportException: No module named random

Why doesn't SharpDevelop see "random"? How can I see him?

+3
source share
1 answer

When you run the IronPython script with ipy.exe, the path to the standard Python library is usually determined from one of the following:

  • IRONPYTHONPATH.
  • lib\site.py, ipy.exe, Python .

SharpDevelop IronPython . . :

  • Python sys.path .

    import sys
    sys.path.append(r'c:\python26\lib')
    
  • Python IRONPYTHONPATH.

    from System import Environment
    pythonPath = Environment.GetEnvironmentVariable("IRONPYTHONPATH")
    import sys
    sys.path.append(pythonPath)
    
  • Python (HKLM\Software\Python\PythonCore\2.6\PythonPath).

  • Python , .

Python, .NET. , Python.

+2

Source: https://habr.com/ru/post/1748736/


All Articles