Python/ASP local characters and 500 server error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin

    Python/ASP local characters and 500 server error

    Using Python / ASP on a IIS server with Mark Hammond's win32 extensions,
    i have the following problem.

    All occurences of local characters (fx. danish æøå) in comments or in
    strings result in a HTTP/1.1 500 Server Error.

    Is there a solution to this problem?

    /Martin
  • Fredrik Lundh

    #2
    Re: Python/ASP local characters and 500 server error

    Martin wrote:
    [color=blue]
    > Using Python / ASP on a IIS server with Mark Hammond's win32 extensions,
    > i have the following problem.
    >
    > All occurences of local characters (fx. danish æøå) in comments or in
    > strings result in a HTTP/1.1 500 Server Error.
    >
    > Is there a solution to this problem?[/color]

    the first thing to do when you get a server error is to look in the server logs
    to see what the real error is.

    in this case, chances are that you'll see a warning message from the Python
    interpreter that points to you this page:

    This PEP proposes to introduce a syntax to declare the encoding of a Python source file. The encoding information is then used by the Python parser to interpret the file using the given encoding. Most notably this enhances the interpretation of Unicode ...


    (scroll down to "Examples" to see the solution)

    </F>



    Comment

    • Fredrik Lundh

      #3
      Re: Python/ASP local characters and 500 server error

      Martin wrote:
      [color=blue]
      > Using Python / ASP on a IIS server with Mark Hammond's win32 extensions,
      > i have the following problem.
      >
      > All occurences of local characters (fx. danish æøå) in comments or in
      > strings result in a HTTP/1.1 500 Server Error.
      >
      > Is there a solution to this problem?[/color]

      the first thing to do when you get a server error is to look in the server logs
      to see what the real error is.

      in this case, chances are that you'll see a warning message from the Python
      interpreter that points to you this page:

      This PEP proposes to introduce a syntax to declare the encoding of a Python source file. The encoding information is then used by the Python parser to interpret the file using the given encoding. Most notably this enhances the interpretation of Unicode ...


      (scroll down to "Examples" to see the solution)

      </F>



      Comment

      • Martin

        #4
        Re: Python/ASP local characters and 500 server error

        Fredrik Lundh wrote:[color=blue]
        >
        > http://www.python.org/peps/pep-0263.html
        >[/color]

        Using the info from pep-0263, adding a line in the start for the file:

        # -*- coding: <charcode> -*-

        works for .py files, but the error i get is from an .asp file.

        The logfile contains this info:

        ASP_0147|500_Se rver_Error 500

        A solution is to move ALL code from the .asp page to a .py file and
        import it on the .asp page.

        But there must be another solution?

        /Martin

        Comment

        • Martin

          #5
          Re: Python/ASP local characters and 500 server error

          Fredrik Lundh wrote:[color=blue]
          >
          > http://www.python.org/peps/pep-0263.html
          >[/color]

          Using the info from pep-0263, adding a line in the start for the file:

          # -*- coding: <charcode> -*-

          works for .py files, but the error i get is from an .asp file.

          The logfile contains this info:

          ASP_0147|500_Se rver_Error 500

          A solution is to move ALL code from the .asp page to a .py file and
          import it on the .asp page.

          But there must be another solution?

          /Martin

          Comment

          Working...