Code Monkey home page Code Monkey logo

lsbaws's Introduction

lsbaws's People

Contributors

rspivak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lsbaws's Issues

list index out of range

After running the pyramid server, I can get the response shown in the browser, but after a few seconds, below error was showing on the console and the server was down:
Traceback (most recent call last):
File "webserver2.py", line 142, in
httpd.serve_forever()
File "webserver2.py", line 41, in serve_forever
self.handle_one_request()
File "webserver2.py", line 51, in handle_one_request
self.parse_request(request_data)
File "webserver2.py", line 64, in parse_request
request_line = text.splitlines()[0]
IndexError: list index out of range

RuntimeError: reentrant call

I came across the Error if I am not comment the "print" after "os.waitpid" when using the code from you github.
I search solution from the internet, it tell me that maybe caused by lock's problem.
So I comment that code and it runs normally.

code

(webserver3h.py from your github, I just add some function about handle some encoding for python3)

def grim_reaper(signum, frame):
    while True:
        try:
            pid, status = os.waitpid(
                -1,          # Wait for any child process
                 os.WNOHANG  # Do not block and return EWOULDBLOCK error
            )
            print(
                'Child {pid} terminated with status {status}\n'.format(pid=pid, status=status)
            )
        except OSError:
            return

Error

    httpd.serve_forever()
  File "webserver3.py", line 72, in serve_forever
    pid = os.fork()
  File "webserver3.py", line 22, in grim_reaper
    'Child {pid} terminated with status {status}\n'.format(pid=pid, status=status)
  File "webserver3.py", line 22, in grim_reaper
    'Child {pid} terminated with status {status}\n'.format(pid=pid, status=status)
RuntimeError: reentrant call inside <_io.BufferedWriter name='<stdout>'>

can't print hello world

Hi, I tried the first demo webserver1.py. When I open the URL http://localhost:8888/hello in my Firefox, the web page is blank. But, the terminal occurs the following massage:

GET /hello HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive

What's wrong?

a simple question

Hi, thanks for the series. I spend this weekend reading these articles and really enjoy them.
But I am so confused that why 'os._exit(0)' should be in the for loop. Does it mean immediately exit the child process after the first connection?

Type Error

Besides having forgotten the parentheses around all the "print" statements in the script for the first part of your tutorial, I get the following error:
"TypeError: a bytes-like object is required, not 'str'" on line 20.

i got some import error with python2

can you help me debug webapp with django

ile "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)

File "/Users/ajmd/code/webserver/helloworld/urls.py" in <module>
  1. from django.conf.urls import patterns, include, url

Exception Type: ImportError at /hello
Exception Value: cannot import name patterns

and the source code:

from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns(
    '',
    # Examples:
    # url(r'^$', 'helloworld.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),

    (r'^hello', 'helloworld.views.index'),

)

little question

['pyramidapp']
Traceback (most recent call last):
File "main.py", line 116, in
module, application = app_path.split(':')
ValueError: need more than 1 value to unpack
Program ended with exit code: 1

curl not display "Hello, World!"

curl(7.58.0) terminated, without display "Hello, World!".

I think, the 'http_response' is deficient.
With this, it working good:

http_response = b"""\
HTTP/1.1 200 OK
Content-Type: text/html

Hello, World!
"""

Part 2 django app doesn't execute well with Django 1.10.1

The part2 server request to load the app callable from the djangoapp doesn't work in Django version 1.10.1

The contents of the helloworld/urls.py has to be changed

from:

from django.conf.urls import patterns, include, url
from django.contrib import admin

urlpatterns = patterns(
'',
# Examples:
# url(r'^$', 'helloworld.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),

url(r'^admin/', include(admin.site.urls)),

(r'^hello', 'helloworld.views.index'),

)

To:

from django.conf.urls import include, url
from django.contrib import admin

from . import views

urlpatterns = [

url(r'^admin/', admin.site.urls),

url(r'^hello/', views.index),

]

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.