FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

mod_wsgi hangs with import clr · Issue #85 · pythonnet/pythonnet · GitHub

Repository navigation

mod_wsgi hangs with import clr #85

Closed

Description

Background

  • in a flask app using mod_wsgi on Apache, if the app has import clr, then the application hangs
  • possible rehash of SourceForge Python.NET bug 16

    "conflict between django+mod-wsgi and clr?"

Activity

  1. eisenheimjelid commented on Dec 16, 2015

    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?

  2. mikofski commented on Dec 16, 2015

    Author

    @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
    
  3. eisenheimjelid commented on Dec 16, 2015

    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.

  4. mikofski commented on Mar 15, 2016

    Author

    related to #180 and #181

  5. den-run-ai commented on Feb 20, 2017

    Contributor

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

  6. mikofski commented on Feb 20, 2017

    Author

    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.

  7. GregoryKimball commented on Feb 12, 2019

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL