Code Monkey home page Code Monkey logo

Comments (7)

GregoryKimball avatar GregoryKimball commented on September 27, 2024 1

I found that this suggestion from Graham Dumpleton solved my problem with server hanging at import clr when using mod-wsgi==4.6.4+ap24vc14 on Python 3.6.5.
https://stackoverflow.com/a/4236503


Set:

WSGIApplicationGroup %{GLOBAL}
See the application issues document on mod_wsgi wiki.

Most likely you have an extension module not designed to work in sub interpreter. The above forces it to run in main interpreter.

from pythonnet.

eisenheimjelid avatar eisenheimjelid commented on September 27, 2024

Hi!, exists some solution for this issue? or alternate solution? In my enviroment i have (pip freeze):
Django==1.7.10
django-braces==1.8.1
django-filter==0.11.0
django-mssql==1.7
django-oauth-toolkit==0.9.0
djangorestframework==3.3.1
Markdown==2.6.5
oauthlib==1.0.1
pythonnet==2.0.0
pywin32==219
requests==2.8.1
six==1.10.0
virtualenv==13.1.2

And run with mod_wsgi 4.4.12, python 2.7.11, apache 2.4 on windows server 2012. I think maybe if i use other connector or other web server can function well, because if i remove 'import clr' from my code in Django, Apache+WSGI are well and all function correct, but if i add 'import clr' webserver doesn't anything, logs are empty and server is without errors. And if using django runserver, all function well.

Any idea?

from pythonnet.

mikofski avatar mikofski commented on September 27, 2024

@eisenheimjelid I had to use IronPython with subprocess

import subprocess
target = ["~/path/to/IronPython27/ipy.exe", "~/path/to/my_dotnet_app.py", "arg0", "arg1", ...]
retval = subprocess.check_output(target, universal_newlines=True)

a little slow depending on your machine, but works fine.

For Windows you will need .NET and for Linux/Darwin you will need Mono

on Ubuntu:

sudo apt-get install mono-complete

from pythonnet.

eisenheimjelid avatar eisenheimjelid commented on September 27, 2024

Thank you @mikofski but that not is my better solution.

Because i use DLL and i require keep open connection with other program on Windows, if i use EXE like function on subprocess (hi.exe args...) imply for each operation send will open and close connection with that program; so will be really slow.

I will search other solution, but 'subprocess' will be my plan b.

So, thanks. Best regards.

PD. The DLL what i use is related with SAP BO, SAP SDK DI API.

from pythonnet.

mikofski avatar mikofski commented on September 27, 2024

related to #180 and #181

from pythonnet.

den-run-ai avatar den-run-ai commented on September 27, 2024

@mikofski @eisenheimjelid why would you use .NET from Flask/Django app?

from pythonnet.

mikofski avatar mikofski commented on September 27, 2024

I needed to use a particular .NET assembly that communicated with an ASP.NET framework to get some data from a MSSQL server. I did not have access to the database directly, nor could I use the ASP.NET framework from Python. It was a black box, and all I was given was the DLL with exposed methods like GetWeatherDataHeader() etc. I used subprocess in the interim and we eventually replaced the entire framework with all Django and PostgreSQL on Linux. So no more need for Python.NET on this project. But there are always others.

from pythonnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.