Bjoern request h 4 10 fatal error ev h no such file or directory

I am getting this error: Running setup.py bdist_wheel for inflection: finished with status 'done' Stored in directory: /pth/to/downloaded/files/wheels/9f/5a/d3/6fc3bf6516d2a3eb7e18f9f28b472...

I am getting this error:

  Running setup.py bdist_wheel for inflection: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/9f/5a/d3/6fc3bf6516d2a3eb7e18f9f28b472110b59325f3f258fe9211
  Running setup.py bdist_wheel for langdetect: started
  Running setup.py bdist_wheel for langdetect: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/ec/0c/a9/1647275e7ef5014e7b83ff30105180e332867d65e7617ddafe
  Running setup.py bdist_wheel for mako: started
  Running setup.py bdist_wheel for mako: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/46/23/48/366f0d8b14d436e58ad0aef531b14af8d8beabeb2986704bd5
  Running setup.py bdist_wheel for marisa-trie: started
  Running setup.py bdist_wheel for marisa-trie: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/45/24/79/022624fc914f0e559fe8a1141aaff1f9df810905a13fc75d57
  Running setup.py bdist_wheel for mongoalchemy: started
  Running setup.py bdist_wheel for mongoalchemy: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/fa/9c/37/a891c91c02a57ec2be4ae93e5680eed4a4d68387a47b4c6963
  Running setup.py bdist_wheel for nltk: started
  Running setup.py bdist_wheel for nltk: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/97/8a/10/d646015f33c525688e91986c4544c68019b19a473cb33d3b55
  Running setup.py bdist_wheel for pycparser: started
  Running setup.py bdist_wheel for pycparser: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511
  Running setup.py bdist_wheel for pymongo: started
  Running setup.py bdist_wheel for pymongo: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/67/85/9a/d543daae3a2c408b9f3407cff14c97f32687f54a4474f55bcb
  Running setup.py bdist_wheel for pyramid-mako: started
  Running setup.py bdist_wheel for pyramid-mako: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/08/5f/98/3dfc5a39bcb3fd094897db7f394eb13768cdf472bdf2a89a2f
  Running setup.py bdist_wheel for pysocks: started
  Running setup.py bdist_wheel for pysocks: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/22/5c/b5/12e0dfdfa85bea67b23628b6425fae715c687e947a45ee3df9
  Running setup.py bdist_wheel for pyyaml: started
  Running setup.py bdist_wheel for pyyaml: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/ad/56/bc/1522f864feb2a358ea6f1a92b4798d69ac783a28e80567a18b
  Running setup.py bdist_wheel for regex: started
  Running setup.py bdist_wheel for regex: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/ae/35/86/47caa8baa5e9340dcb02a719f64a7091900e28af7368d35731
  Running setup.py bdist_wheel for sqlalchemy: started
  Running setup.py bdist_wheel for sqlalchemy: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/6b/02/e3/7f1149be63131cdf6aaaa3330924a2683bb530188940569d66
  Running setup.py bdist_wheel for validators: started
  Running setup.py bdist_wheel for validators: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/e5/0b/3d/bdf3cec5ca8ee8c42b6ed8fdbd0fa59c8b7b627b5a8addc542
  Running setup.py bdist_wheel for wikipedia: started
  Running setup.py bdist_wheel for wikipedia: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/87/2a/18/4e471fd96d12114d16fe4a446d00c3b38fb9efcb744bd31f4a
  Running setup.py bdist_wheel for pyramid-handlers: started
  Running setup.py bdist_wheel for pyramid-handlers: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/45/cf/65/66b6c125d64dd3a164b712ea17fbb54195d8965609e0e68fbc
  Running setup.py bdist_wheel for googlemaps: started
  Running setup.py bdist_wheel for googlemaps: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/3c/3f/25/ce6d7722dba07e5d4a12d27ab38f3d7add65ef43171b02c819
  Running setup.py bdist_wheel for bjoern: started
  Running setup.py bdist_wheel for bjoern: finished with status 'error'
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-k55q9ikw/bjoern/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpw4pnotf2pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  copying bjoern.py -> build/lib.linux-x86_64-3.6
  running build_ext
  building '_bjoern' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/http-parser
  creating build/temp.linux-x86_64-3.6/bjoern
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -DWANT_SIGNAL_HANDLING=1 -DSIGNAL_CHECK_INTERVAL=0.1 -Ihttp-parser -I/usr/include/libev -I/usr/include/python3.6m -c http-parser/http_parser.c -o build/temp.linux-x86_64-3.6/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -DWANT_SIGNAL_HANDLING=1 -DSIGNAL_CHECK_INTERVAL=0.1 -Ihttp-parser -I/usr/include/libev -I/usr/include/python3.6m -c bjoern/_bjoernmodule.c -o build/temp.linux-x86_64-3.6/bjoern/_bjoernmodule.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
  In file included from bjoern/wsgi.h:2:0,
                   from bjoern/_bjoernmodule.c:3:
  bjoern/request.h:4:10: fatal error: ev.h: No such file or directory
   #include <ev.h>
            ^~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for bjoern
  Running setup.py clean for bjoern
  Running setup.py bdist_wheel for psutil: started
  Running setup.py bdist_wheel for psutil: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/90/7e/74/bb640d77775e6b6a78bcc3120f9fea4d2a28b2706de1cff37d
  Running setup.py bdist_wheel for sshtunnel: started
  Running setup.py bdist_wheel for sshtunnel: finished with status 'done'
  Stored in directory: /pth/to/downloaded/files/wheels/e8/d2/38/b9791b7391f634099194ec6697fa671194f3353906d94c8f92
Successfully built cairocffi future inflection langdetect mako marisa-trie mongoalchemy nltk pycparser pymongo pyramid-mako pysocks pyyaml regex sqlalchemy validators wikipedia pyramid-handlers googlemaps psutil sshtunnel
Failed to build bjoern
Installing collected packages: asn1crypto, soupsieve, beautifulsoup4, numpy, blis, urllib3, botocore, boto3, boto, pycparser, cffi, setuptools, cairocffi, chardet, certifi, idna, requests, future, census, iso8601, translationstring, colander, webencodings, tinycss2, cssselect2, cx-oracle, cymem, decorator, defusedxml, elasticsearch, envoy, smmap2, gitdb2, gitpython, httplib2, hupper, inflection, six, isodate, jsonpickle, jsonschema, langdetect, lxml, markupsafe, mako, marisa-trie, pymongo, mongoalchemy, more-itertools, murmurhash, pyopenssl, ndg-httpsclient, nltk, oauthlib, pytz, pandas, paste, pastedeploy, pillow, plac, plaster, plaster-pastedeploy, preshed, pygments, pyparsing, repoze.lru, venusian, webob, zope.deprecation, zope.interface, pyramid, pyramid-mako, pyramid-debugtoolbar, transaction, pyramid-tm, pysocks, pyyaml, quandl, rdflib, redis, regex, requests-oauthlib, scipy, tqdm, wasabi, srsly, thinc, spacy, sparqlwrapper, sqlalchemy, tweepy, unidecode, validators, waitress, webtest, wikipedia, zope.sqlalchemy, pyramid-handlers, googlemaps, bjoern, cairosvg, psutil, bcrypt, pynacl, paramiko, sshtunnel
  Found existing installation: asn1crypto 0.24.0
    Not uninstalling asn1crypto at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: urllib3 1.25.3
    Uninstalling urllib3-1.25.3:
      Successfully uninstalled urllib3-1.25.3
  Found existing installation: botocore 1.12.157
    Uninstalling botocore-1.12.157:
      Successfully uninstalled botocore-1.12.157
  Found existing installation: setuptools 39.0.1
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: idna 2.6
    Not uninstalling idna at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: six 1.11.0
    Not uninstalling six at /usr/lib/python3/dist-packages, outside environment /usr
  Found existing installation: nltk 3.4.4
    Uninstalling nltk-3.4.4:
      Successfully uninstalled nltk-3.4.4
  Found existing installation: PyYAML 3.13
    Uninstalling PyYAML-3.13:
      Successfully uninstalled PyYAML-3.13
  Running setup.py install for bjoern: started
    Running setup.py install for bjoern: finished with status 'error'
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-k55q9ikw/bjoern/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-i0kkx69r-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    copying bjoern.py -> build/lib.linux-x86_64-3.6
    running build_ext
    building '_bjoern' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/http-parser
    creating build/temp.linux-x86_64-3.6/bjoern
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -DWANT_SIGNAL_HANDLING=1 -DSIGNAL_CHECK_INTERVAL=0.1 -Ihttp-parser -I/usr/include/libev -I/usr/include/python3.6m -c http-parser/http_parser.c -o build/temp.linux-x86_64-3.6/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -DWANT_SIGNAL_HANDLING=1 -DSIGNAL_CHECK_INTERVAL=0.1 -Ihttp-parser -I/usr/include/libev -I/usr/include/python3.6m -c bjoern/_bjoernmodule.c -o build/temp.linux-x86_64-3.6/bjoern/_bjoernmodule.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
    In file included from bjoern/wsgi.h:2:0,
                     from bjoern/_bjoernmodule.c:3:
    bjoern/request.h:4:10: fatal error: ev.h: No such file or directory
     #include <ev.h>
              ^~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-k55q9ikw/bjoern/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-i0kkx69r-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-k55q9ikw/bjoern/

The command '/bin/sh -c pip3 install --cache-dir="/pth/to/downloaded/files" -r '/interos/temp/requirements.txt' -c '/interos/temp/constraints.txt'' returned a non-zero code: 1

Попытка установить bjoern локально и на Heroku не удалась с тем же сообщением, например

$ pip --version
pip 9.0.1 from /path/to/python2.7/site-packages (python 2.7)

$ pip install bjoern
...
bjoern/request.h:4:16: fatal error: ev.h: No such file or directory
...
Failed building wheel for bjoern

Есть предположения?

Все 11 Комментарий

У вас есть libev_devel?

发 自我 的 iPhone

在 2018 年 1 月 19 , 07:06 , Райан Уэст [email protected]写道 :

Полная трассировка здесь: http://dpaste.com/1CMTYRF


Вы получаете это, потому что подписаны на эту ветку.
Ответьте на это письмо напрямую, просмотрите его на GitHub или отключите чат.

Спасибо за быстрый комментарий — да, похоже, в этом проблема. Имеет ли смысл указывать это требование в инструкциях по установке? Я понимаю, что, посмотрев на ошибку, я должен был понять, что она не работает на ev.h, и отследить ее, но я ценю помощь.

Что это за ОС? Если его нет в инструкции по установке, вы можете добавить его.

Просто ударил это сам на debian, попытался установить файлы ниже

apt install libev-dev libevdev2

Похоже, что в debian или ubuntu нет ничего, что называется libev_devel.

У меня это работает, не знаю, как выполнить apt install libev-dev && pip install bjoern с использованием pip install requirements. Txt не работает и не может найти файл заголовка.

вероятно, что-то еще происходит, поэтому я буду копать дальше.

У меня на macOS 10.13.4 было то же самое, пришлось сделать:

 brew install libev

Тогда pip install bjoern сработало.

Кто-нибудь знает, как заставить его работать в Windows. brew install libev и apt install libev-dev libevdev2 не является допустимым комментарием в Windows.

Бьорн не поддерживает Windows

Была ли эта страница полезной?

0 / 5 — 0 рейтинги

Traceback:

`Repl.it: Updating package configuration

—> python3 -m poetry add Bjoern
Using version ^3.1.0 for Bjoern

Updating dependencies
Resolving dependencies…

Package operations: 1 install, 0 updates, 0 removals

  • Installing Bjoern (3.1.0)

[EnvCommandError]
Command [‘/opt/virtualenvs/python3/bin/pip’, ‘install’, ‘—no-deps’, ‘bjoern==3.1.0’] errored with the following return code 1, and output:
Collecting bjoern==3.1.0
Using cached https://files.pythonhosted.org/packages/8f/d9/729bed4f535574bd2ca7d541e88f94f5ae678c341f4df153a70a3ff3a695/bjoern-3.1.0.tar.gz
Building wheels for collected packages: Bjoern
Building wheel for Bjoern (setup.py): started
Building wheel for bjoern (setup.py): finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /opt/virtualenvs/python3/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-install-sntn21hu/bjoern/setup.py'»‘»‘; file='»‘»‘/tmp/pip-install-sntn21hu/bjoern/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ bdist_wheel -d /tmp/pip-wheel-rsvbklsv —python-tag cp38
cwd: /tmp/pip-install-sntn21hu/bjoern/
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying bjoern.py -> build/lib.linux-x86_64-3.8
running build_ext
building ‘_bjoern’ extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/http-parser
creating build/temp.linux-x86_64-3.8/bjoern
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSIGNAL_CHECK_INTERVAL=0.1 -DWANT_SIGNAL_HANDLING=yes -DWANT_SIGINT_HANDLING=yes -Ihttp-parser -Istatsd-c-client -I/usr/include/libev -I/opt/local/include -I/opt/virtualenvs/python3/include -I/usr/include/python3.8 -c http-parser/http_parser.c -o build/temp.linux-x86_64-3.8/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSIGNAL_CHECK_INTERVAL=0.1 -DWANT_SIGNAL_HANDLING=yes -DWANT_SIGINT_HANDLING=yes -Ihttp-parser -Istatsd-c-client -I/usr/include/libev -I/opt/local/include -I/opt/virtualenvs/python3/include -I/usr/include/python3.8 -c bjoern/_bjoernmodule.c -o build/temp.linux-x86_64-3.8/bjoern/_bjoernmodule.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
In file included from bjoern/wsgi.h:2:0,
from bjoern/_bjoernmodule.c:3:
bjoern/request.h:4:10: fatal error: ev.h: No such file or directory
#include <ev.h>
^~~~~~
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

ERROR: Failed building wheel for Bjoern
Running setup.py clean for bjoern
Failed to build bjoern
Installing collected packages: bjoern
Running setup.py install for bjoern: started
Running setup.py install for bjoern: finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /opt/virtualenvs/python3/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-install-sntn21hu/bjoern/setup.py'»‘»‘; file='»‘»‘/tmp/pip-install-sntn21hu/bjoern/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record /tmp/pip-record-kbxfyffj/install-record.txt —single-version-externally-managed —compile —install-headers /opt/virtualenvs/python3/include/site/python3.8/bjoern
cwd: /tmp/pip-install-sntn21hu/bjoern/
Complete output (20 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
copying bjoern.py -> build/lib.linux-x86_64-3.8
running build_ext
building ‘_bjoern’ extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/http-parser
creating build/temp.linux-x86_64-3.8/bjoern
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSIGNAL_CHECK_INTERVAL=0.1 -DWANT_SIGNAL_HANDLING=yes -DWANT_SIGINT_HANDLING=yes -Ihttp-parser -Istatsd-c-client -I/usr/include/libev -I/opt/local/include -I/opt/virtualenvs/python3/include -I/usr/include/python3.8 -c http-parser/http_parser.c -o build/temp.linux-x86_64-3.8/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DSIGNAL_CHECK_INTERVAL=0.1 -DWANT_SIGNAL_HANDLING=yes -DWANT_SIGINT_HANDLING=yes -Ihttp-parser -Istatsd-c-client -I/usr/include/libev -I/opt/local/include -I/opt/virtualenvs/python3/include -I/usr/include/python3.8 -c bjoern/_bjoernmodule.c -o build/temp.linux-x86_64-3.8/bjoern/_bjoernmodule.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
In file included from bjoern/wsgi.h:2:0,
from bjoern/_bjoernmodule.c:3:
bjoern/request.h:4:10: fatal error: ev.h: No such file or directory
#include <ev.h>
^~~~~~
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
—————————————-
ERROR: Command errored out with exit status 1: /opt/virtualenvs/python3/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘/tmp/pip-install-sntn21hu/bjoern/setup.py'»‘»‘; file='»‘»‘/tmp/pip-install-sntn21hu/bjoern/setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record /tmp/pip-record-kbxfyffj/install-record.txt —single-version-externally-managed —compile —install-headers /opt/virtualenvs/python3/include/site/python3.8/bjoern Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
You should consider upgrading via the ‘pip install —upgrade pip’ command.

exit status 1

Repl.it: Package operation failed.`

jonashaag / bjoern
Goto Github
PK

View Code? Open in Web Editor
NEW

2.9K
77.0
187.0
610 KB

A screamingly fast Python 2/3 WSGI server written in C.

License: Other

Emacs Lisp 0.19%

Makefile 3.33%

Python 32.95%

C 60.58%

Shell 2.95%

bjoern’s Introduction

bjoern: Fast And Ultra-Lightweight HTTP/1.1 WSGI Server

Join the chat at https://gitter.im/jonashaag/bjoern

A screamingly fast, ultra-lightweight WSGI server for CPython 2 and CPython 3,
written in C using Marc Lehmann’s high performance libev event loop and
Ryan Dahl’s http-parser.

Why It’s Cool

bjoern is the fastest, smallest and most lightweight WSGI server out there,
featuring

  • ~ 1000 lines of C code
  • Memory footprint ~ 600KB
  • Python 2 and Python 3 support (thanks @yanghao!)
  • Single-threaded and without coroutines or other crap
  • Can bind to TCP host:port addresses and Unix sockets (thanks @k3d3!)
  • Full persistent connection («keep-alive«) support in both HTTP/1.0 and 1.1,
    including support for HTTP/1.1 chunked responses

Installation

pip install bjoern. See wiki for details.

Usage

Flask example

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    return "Hello, World!"

if __name__ == "__main__":
    import bjoern

    bjoern.run(app, "127.0.0.1", 8000)

Advanced usage

# Bind to TCP host/port pair:
bjoern.run(wsgi_application, host, port)

# TCP host/port pair, enabling SO_REUSEPORT if available.
bjoern.run(wsgi_application, host, port, reuse_port=True)

# Bind to Unix socket:
bjoern.run(wsgi_application, 'unix:/path/to/socket')

# Bind to abstract Unix socket: (Linux only)
bjoern.run(wsgi_application, 'unix:@socket_name')

# Enable statsd metrics. See instrumentation.md for details.
bjoern.run(wsgi_application, host, port, statsd=...)

Alternatively, the mainloop can be run separately:

bjoern.listen(wsgi_application, host, port)
bjoern.run()

# With metrics. See instrumentation.md for details.
bjoern.listen(wsgi_application, host, port)
bjoern.run(statsd=...)

You can also simply pass a Python socket(-like) object. Note that you are responsible
for initializing and cleaning up the socket in that case.

bjoern.server_run(socket_object, wsgi_application)
bjoern.server_run(filedescriptor_as_integer, wsgi_application)

# This needs manual compilation with `WANT_STATSD=yes`
bjoern.server_run(socket_object, wsgi_application, enable_statsd=True)

bjoern’s People

bjoern’s Issues

Benchmark

Turn as many tests into unittests as possible

Update readme to include installation instructions.

The requirement for libev is important; and missing on my Snow Leopard install. There is a separate issue (resolved) about bjoern failing to compile on kubuntu (#4, «failed to compile»).

64 bit compilation fails (fPIC blabla)

environ `PATH_INFO` should be unquoted

According to CGI/1.1, environ PATH_INFO should be unquoted

thread.local support

Hi, I’m having trouble trying out bjoern for an existing web app that currently runs on a threaded server. The problem is the app uses thread.local to store state during a request. Since bjoern is single threaded this fails non-deterministically even for small number of concurrent requests. gevent is also single threaded but seems to get around this issue by monkey patching thread.local (among several others). Is there (going to be) similar support in bjoern?

Memory leak in wsgi_iterable_get_next_chunk

Leaks empty strings

Possible memory leaks with ASSERT_ISINSTANCE

Not in all cases, but in most (depends on whether the former call created a new reference)

Bjoern Installation Fails on Mac OS X 10.6 w/ Homebrew, Xcode 4

Interestingly enough, a fresh install still produces errors. The process:

  1. Install Mac OS X 10.6.
  2. Install Xcode 4 Build 4A225.
  3. Install latest Python 2.7 from .pkg installer.
  4. Install homebrew and run: brew install libev
  5. Install virtualenv for 2.7, create a new environment, and enter it.
  6. Run: pip install bjoern

The pip.log is: http://dpaste.de/wDGo/

Again it seems like I’m dealing with architecture (x86 vs. x64) issues. I’ll have to see if there’s a way to make brew install universal (dual 32-bit and 64-bit) versions.

How bjoern deal with I/O ops in request handlers?

Hi,

bjoern has its own event loop to accept client connection in a non-blocking mode. I believe that bjoern and Tornado work in the same way in this regard.

However, Tornado provides developers with a callback-based programming model to integrate I/O ops happening in request handler with Tornado event loop. Therefore, I/O ops in request handlers can work in non-blocking mode without blocking Tornado’s event loop when it runs.

I don’t understand how it works in bjoern. For example, if I use urllib.open against an URL, how can I register the newly opened socket with bjoern event loop. The same concern are database connection (TCP socket), UDP socket, regular file (open, write), stdout, stdin , … thread joins …

PS: I used Tornado to power my company API server 3 years ago. If our database connection socket is not registered with Tornado event loop, it will block the Tornado process. No incoming request can be handled

http-parser/http_parser.c is missing

[email protected]:/bjoern$ python ./setup.py build
running build
running build_ext
building ‘bjoern’ extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/http-parser
creating build/temp.linux-x86_64-2.7/bjoern
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/include/python2.7 -c http-parser/http_parser.c -o build/temp.linux-x86_64-2.7/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
x86_64-linux-gnu-gcc: error: http-parser/http_parser.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 4
[email protected]:/bjoern$ ls http-parser/
[email protected]:~/bjoern$

commit c79d7b1
Author: Jonas Haag [email protected]
Date: Fri Jun 7 01:14:14 2013 +0200

run as service in ubuntu

hello, i use bjoern but i just run it from a python file with a «&» at the end —
is there a way to set it up as a system service, so i can have something like monit or watchdog restart it if it fails?
thank you,
greg

Could it work under Python 2.5?

Under Python 2.5, compiling bjoern fails with errors like:

src/wsgi_sendfile.c: In function ‘wsgi_sendfile_init’:
src/wsgi_sendfile.c:6: warning: implicit declaration of function ‘PyFile_IncUseCount’
src/wsgi_sendfile.c: In function ‘wsgi_sendfile’:
src/wsgi_sendfile.c:85: warning: implicit declaration of function ‘PyFile_DecUseCount’
src/wsgi_sendfile.c:86: warning: dereferencing ‘void *’ pointer
src/wsgi_sendfile.c:86: error: request for member ‘ob_refcnt’ in something not a structure or union

Could we fix this?

SIGINT (or some other) handler must wait for last request to complete

ev_signal_on_sigint(struct ev_loop* mainloop, ev_signal* watcher, const int events)
ev_signal_on_sigint(struct ev_loop* mainloop, ev_signal* watcher, const int events)
{
  /* Clean up and shut down this thread.
   * (Shuts down the Python interpreter if this is the main thread) */
  ev_unloop(mainloop, EVUNLOOP_ALL);
  PyErr_SetInterrupt();
}

This code bluntly interrupts request in processing. What is needed for graceful stop is ability to wait for current request to complete and only then raise exception or exit process.

Building fails on Arch Linux

cc -I/usr/include/python3.1 -I/usr/include/python3.1 -I . -I bjoern -I http-parser -D WANT_SENDFILE -D WANT_SIGINT_HANDLING -std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -O3 -fPIC -c bjoern/bjoernmodule.c -o build/bjoernmodule.o
In file included from bjoern/server.h:1:0,
                 from bjoern/bjoernmodule.c:2:
bjoern/request.h:4:16: fatal error: ev.h: No such file or directory
compilation terminated.
make: *** [build/bjoernmodule.o] Error 1

This is against HEAD (2010-12-24 18:58 UTC).

gcc version 4.5.1 20101125
Python version 2.7.1

Any thougths?

bjoern and gevent

Does bjoern work with gevent? I want to migrate my WSGI app powered by gunicorn (gevent worker) to bjoern. I am using gevent API (spawn, Pool, monkey patch) in our app too.

Is it possible?

Installation issues.

First of all thanks for such great working WSGI server. I ran a couple of benchmarks using ab against tornado, gevent and gunicorn. And it definitely makes them bite the dust. I am impressed. But what follows is my installations issue. Though i have got around it, it does need a mention i thought

On my Fedora13(32-bit) machine the libev headers are in /usr/lib/libev which is not where the bjoern is looking for when it compiles.

This leads to failure in compilation.

In file included from bjoern/request.c:3:
bjoern/request.h:4:16: error: ev.h: No such file or directory
In file included from bjoern/request.c:3:
bjoern/request.h:38: error: expected specifier-qualifier-list before ‘ev_io’
bjoern/request.c: In function ‘Request_new’:
bjoern/request.c:30: error: ‘Request’ has no member named ‘parser’
bjoern/request.c:31: error: ‘Request’ has no member named ‘parser’
bjoern/request.c:33: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:34: error: ‘Request’ has no member named ‘body’
bjoern/request.c:35: error: ‘Request’ has no member named ‘response’
bjoern/request.c:36: error: ‘Request’ has no member named ‘status’
bjoern/request.c: In function ‘Request_parse’:
bjoern/request.c:45: error: ‘Request’ has no member named ‘parser’
bjoern/request.c: In function ‘Request_free’:
bjoern/request.c:58: error: ‘Request’ has no member named ‘response’
bjoern/request.c:58: error: ‘Request’ has no member named ‘response’
bjoern/request.c:58: error: ‘Request’ has no member named ‘response’
bjoern/request.c:58: error: ‘Request’ has no member named ‘response’
bjoern/request.c:66: error: ‘Request’ has no member named ‘body’
bjoern/request.c:66: error: ‘Request’ has no member named ‘body’
bjoern/request.c:66: error: ‘Request’ has no member named ‘body’
bjoern/request.c:66: error: ‘Request’ has no member named ‘body’
bjoern/request.c:67: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:69: error: ‘Request’ has no member named ‘status’
bjoern/request.c:71: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:71: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:71: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:71: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:72: error: ‘Request’ has no member named ‘status’
bjoern/request.c:72: error: ‘Request’ has no member named ‘status’
bjoern/request.c:72: error: ‘Request’ has no member named ‘status’
bjoern/request.c:72: error: ‘Request’ has no member named ‘status’
bjoern/request.c: In function ‘on_message_begin’:
bjoern/request.c:155: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_path’:
bjoern/request.c:166: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_query_string’:
bjoern/request.c:176: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_url’:
bjoern/request.c:186: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_fragment’:
bjoern/request.c:196: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_header_field’:
bjoern/request.c:208: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_headers_complete’:
bjoern/request.c:243: error: ‘Request’ has no member named ‘headers’
bjoern/request.c: In function ‘on_body’:
bjoern/request.c:254: error: ‘Request’ has no member named ‘body’
bjoern/request.c:259: error: ‘Request’ has no member named ‘body’
bjoern/request.c:262: error: ‘Request’ has no member named ‘body’
bjoern/request.c: In function ‘on_message_complete’:
bjoern/request.c:275: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:278: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:281: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:287: error: ‘Request’ has no member named ‘body’
bjoern/request.c:287: error: ‘Request’ has no member named ‘body’
bjoern/request.c:287: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:295: error: ‘Request’ has no member named ‘headers’
bjoern/request.c:300: error: ‘Request’ has no member named ‘headers’
error: command ‘gcc’ failed with exit status 1

It works fine if i copy the headers in the bjoern directory and modify server.c and request.h accordingly.

Error while installing on ubuntu 14.04

running install
running build
running build_py
running build_ext
building ‘_bjoern’ extension
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/include/libev -I/usr/include/python2.7 -c http-parser/http_parser.c -o build/temp.linux-i686-2.7/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/include/libev -I/usr/include/python2.7 -c bjoern/portable_sendfile.c -o build/temp.linux-i686-2.7/bjoern/portable_sendfile.o -std=c99 -fno-strict-aliasing -fcommon -fPIC -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g
In file included from bjoern/portable_sendfile.c:3:0:
bjoern/portable_sendfile.h:1:41: fatal error: Python.h: No such file or directory
#include <Python.h> /* for Py_ssize_t */
^
compilation terminated.
error: command ‘i686-linux-gnu-gcc’ failed with exit status 1

Create a Chaussette Backend

Is it possible to create a bjoern backend for chaussette ?

I doesn’t look that complicated but I don’t know where to start.

Refs circus-tent/chaussette#26

Keepalive not working?

Testing with apachebench and curl; verbose output from curl, which you can see tries to reuse the connection:

curl -v http://192.168.1.190:8081 http://192.168.1.190:8081
* About to connect() to 192.168.1.190 port 8081 (#0)
*   Trying 192.168.1.190... connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 192.168.1.190:8081
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-type: text/plain
< Content-Length: 5
< 
* Connection #0 to host 192.168.1.190 left intact
* Connection #0 seems to be dead!
* Closing connection #0
* About to connect() to 192.168.1.190 port 8081 (#0)
*   Trying 192.168.1.190... connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-unknown-linux-gnu) libcurl/7.22.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 192.168.1.190:8081
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-type: text/plain
< Content-Length: 5
< 
* Connection #0 to host 192.168.1.190 left intact
* Closing connection #0
Pong!Pong

Note the ‘connection seems to be dead’ line, and that the content of two responses seems to come all at once at the end («Pong!Pong!»), rather than displayed inline with the request as Curl would normally do.
apachebench with -k flag will just hang after making a connection (presumably after the first request is served).

Here’s my test app:

#!/usr/bin/python 

import bjoern

def application(environ, start_response):
    status = '200 OK'
    output = 'Pong!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)
    return [output]

bjoern.run(application, '192.168.1.190', 8081)

Testing with the latest code base.

Worth noting that Curl does not pipeline requests, it’s waiting for the response before sending the second request.

Cannot checkout http-parser submodule [refers to non-existing tree]

Cloning the repository with the submodules doesn’t work.

$ git clone --recursive [email protected]:gorakhargosh/bjoern.git
Cloning into bjoern...
remote: Counting objects: 1268, done.
remote: Compressing objects: 100% (512/512), done.
remote: Total 1268 (delta 808), reused 1148 (delta 737)
Receiving objects: 100% (1268/1268), 215.80 KiB | 67 KiB/s, done.
Resolving deltas: 100% (808/808), done.
Submodule 'http-parser' (git://github.com/ry/http-parser) registered for path 'http-parser'
Cloning into http-parser...
remote: Counting objects: 664, done.
remote: Compressing objects: 100% (248/248), done.
remote: Total 664 (delta 447), reused 619 (delta 413)
Receiving objects: 100% (664/664), 156.09 KiB | 75 KiB/s, done.
Resolving deltas: 100% (447/447), done.
fatal: reference is not a tree: 5338fbd4f2a5ac9b8478d9f5fad8f125e6ae4236
Unable to checkout '5338fbd4f2a5ac9b8478d9f5fad8f125e6ae4236' in submodule path 'http-parser'

Document (implement?) logging

Right now Bjoern does not seem to have any logging capability. It would be nice to provide an option (or a callback) to do it. Alternatively, I guess the option is to use a logging middleware.

Update to new http-parser API

They removed the path and query callbacks and added a URL parsing utility instead.

Any way to prevent the use of sendfile?

I don’t really speak C, so I couldn’t figure out if and how I could make bjoern not use sendfile. I need to conditionally prevent it from using sendfile (if it’s using it at all) to prevent weird caching behavior in VirtualBox (see here for more information).

Request IP/host

Would it be difficult to include a REQUEST_IP key in the request dictionary? Is there already an obvious method of obtaining this information?

python3

Hello!

Im try setup bjoern on Python3
$ python3 -V
Python 3.1.3

$ python3 setup.py build

:

In file included from bjoern/common.h:11,
from bjoern/common.c:1:
bjoern/25compat.h:5:1: warning: «PyVarObject_HEAD_INIT» redefined
In file included from /usr/include/python3.1/Python.h:64,
from bjoern/common.h:4,
from bjoern/common.c:1:
/usr/include/python3.1/object.h:84:1: warning: this is the location of the previous definition
…..
:

bjoern/request.c:2:23: error: cStringIO.h: No such file or directory
In file included from bjoern/common.h:11,
from bjoern/request.h:6,
from bjoern/request.c:3:

$ find /usr/include -name cStringIO.h
/usr/include/python2.7/cStringIO.h

Found v2.7 only. What to do with v3.x?

segfault introduced in e268

When running tests/hello.py two requests succeed and the third segfaults. Reverting to 772d resolves the issue on my system.

Incompatible data type on ARM

Hi,

bjoern builds correctly on ARM, except for one warning, which is important:

bjoern/common.c:18:7: warning: comparison is always false due to limited range of data type [-Wtype-limits]

The reason is that (-1) in the NOHEX macro is interpreted as int by the compiler, not as char.

A simple fix would be to replace line 6 of common.c with

#define NOHEX ((char) -1)

which also makes the code slightly easier to read.

I guess a Pull Request is too much hassle for a one-liner, hence an Issue.

Cheers!

flask does not run in bjoern server

hi,when I test app on the bjoern server,console displays below errors

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/app.py", line 1506, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/app.py", line 1504, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/app.py", line 1264, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/app.py", line 1262, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/app.py", line 1248, in dispatch_request
    return self.view_functionsrule.endpoint
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/helpers.py", line 623, in send_static_file
    return send_from_directory(self.static_folder, filename)
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/helpers.py", line 473, in send_from_directory
    return send_file(filename, conditional=True, **options)
  File "/usr/local/lib/python2.6/dist-packages/Flask-0.8-py2.6.egg/flask/helpers.py", line 385, in send_file
    data = wrap_file(request.environ, file)
  File "/usr/local/lib/python2.6/dist-packages/Werkzeug-0.8.3-py2.6.egg/werkzeug/wsgi.py", line 536, in wrap_file
    return environ.get('wsgi.file_wrapper', FileWrapper)(file, buffer_size)
TypeError: FileWrapper() takes exactly 1 argument (2 given)

unquote_url_inplace shouldn’t unquote in place (or exist?)

The type signature for for the on_path function in bjoern.c is supposed to take the path as a const char * to match the function signature that http-parser expects, but actually takes a char *. Right now there’s actually a compiler warning when building bjoern about this. The function on_path actually mutates the data pointed to by the path pointer, since it unquotes in place.

I think the right thing here to do is actually to not URL unquote at all. In my testing of a handful of other WSGI servers, none of them automatically unquoted URLs; I guess the expectation is that whatever WSGI framework you’re using will do the unquoting, not the WSGI server itself. So not only is this unquoting thing unhygienic for violating constness, it actually makes bjoern generally incompatible with most other WSGI frameworks. I’m happy to provide a patch to just remove the URL unquoting code if you agree.

Installation still failing on Mac OS X 10.6.5

Issue #11 doesn’t seem to be fixed for me. I think I’m doing everything right:

brew install libev
mkvirtualenv bjoern
pip install bjoern

Full contents of pip.log below:

------------------------------------------------------------
/Users/jamie/.virtualenvs/bjoern/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/runner.py run on Wed Dec 29 16:55:59 2010
Downloading/unpacking bjoern
  Running setup.py egg_info for package bjoern
    running egg_info
    writing pip-egg-info/bjoern.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/bjoern.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/bjoern.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found
    reading manifest file 'pip-egg-info/bjoern.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/bjoern.egg-info/SOURCES.txt'
Installing collected packages: bjoern
  Running setup.py install for bjoern
    Running command /Users/jamie/.virtualenvs/bjoern/bin/python -c "import setuptools;__file__='/Users/jamie/.virtualenvs/bjoern/build/bjoern/setup.py';execfile(__file__)" install --single-version-externally-managed --record /var/folders/jT/jTsZ5I2lHYODq98s5pizV++++TI/-Tmp-/pip-guk8Dz-record/install-record.txt --install-headers /Users/jamie/.virtualenvs/bjoern/bin/../include/site/python2.6
    running install
    running build
    running build_ext
    building 'bjoern' extension
    gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc -arch x86_64 build/temp.macosx-10.6-universal-2.6/http-parser/http_parser.o build/temp.macosx-10.6-universal-2.6/bjoern/request.o build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o build/temp.macosx-10.6-universal-2.6/bjoern/server.o build/temp.macosx-10.6-universal-2.6/bjoern/wsgi.o -lev -o build/lib.macosx-10.6-universal-2.6/bjoern.so
    ld: warning: in /usr/local/lib/libev.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    ld: duplicate symbol _StartResponse_Type in build/temp.macosx-10.6-universal-2.6/bjoern/server.o and build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o for architecture i386
    collect2: ld returned 1 exit status
    ld: warning: in /usr/local/lib/libev.dylib, file was built for unsupported file format which is not the architecture being linked (ppc)
    ld: duplicate symbol _StartResponse_Type in build/temp.macosx-10.6-universal-2.6/bjoern/server.o and build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o for architecture ppc
    collect2: ld returned 1 exit status
    ld: duplicate symbol _StartResponse_Type in build/temp.macosx-10.6-universal-2.6/bjoern/server.o and build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o for architecture x86_64
    collect2: ld returned 1 exit status
    lipo: can't open input file: /var/folders/jT/jTsZ5I2lHYODq98s5pizV++++TI/-Tmp-//cchfuOFY.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /Users/jamie/.virtualenvs/bjoern/bin/python -c "import setuptools;__file__='/Users/jamie/.virtualenvs/bjoern/build/bjoern/setup.py';execfile(__file__)" install --single-version-externally-managed --record /var/folders/jT/jTsZ5I2lHYODq98s5pizV++++TI/-Tmp-/pip-guk8Dz-record/install-record.txt --install-headers /Users/jamie/.virtualenvs/bjoern/bin/../include/site/python2.6:
    running install

running build

running build_ext

building 'bjoern' extension

gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc -arch x86_64 build/temp.macosx-10.6-universal-2.6/http-parser/http_parser.o build/temp.macosx-10.6-universal-2.6/bjoern/request.o build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o build/temp.macosx-10.6-universal-2.6/bjoern/server.o build/temp.macosx-10.6-universal-2.6/bjoern/wsgi.o -lev -o build/lib.macosx-10.6-universal-2.6/bjoern.so

ld: warning: in /usr/local/lib/libev.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

ld: duplicate symbol _StartResponse_Type in build/temp.macosx-10.6-universal-2.6/bjoern/server.o and build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o for architecture i386

collect2: ld returned 1 exit status

ld: warning: in /usr/local/lib/libev.dylib, file was built for unsupported file format which is not the architecture being linked (ppc)

ld: duplicate symbol _StartResponse_Type in build/temp.macosx-10.6-universal-2.6/bjoern/server.o and build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o for architecture ppc

collect2: ld returned 1 exit status

ld: duplicate symbol _StartResponse_Type in build/temp.macosx-10.6-universal-2.6/bjoern/server.o and build/temp.macosx-10.6-universal-2.6/bjoern/bjoernmodule.o for architecture x86_64

collect2: ld returned 1 exit status

lipo: can't open input file: /var/folders/jT/jTsZ5I2lHYODq98s5pizV++++TI/-Tmp-//cchfuOFY.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
Command /Users/jamie/.virtualenvs/bjoern/bin/python -c "import setuptools;__file__='/Users/jamie/.virtualenvs/bjoern/build/bjoern/setup.py';execfile(__file__)" install --single-version-externally-managed --record /var/folders/jT/jTsZ5I2lHYODq98s5pizV++++TI/-Tmp-/pip-guk8Dz-record/install-record.txt --install-headers /Users/jamie/.virtualenvs/bjoern/bin/../include/site/python2.6 failed with error code 1
Exception information:
Traceback (most recent call last):
  File "/Users/jamie/.virtualenvs/bjoern/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/basecommand.py", line 130, in main
    self.run(options, args)
  File "/Users/jamie/.virtualenvs/bjoern/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/commands/install.py", line 228, in run
    requirement_set.install(install_options, global_options)
  File "/Users/jamie/.virtualenvs/bjoern/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/req.py", line 1043, in install
    requirement.install(install_options, global_options)
  File "/Users/jamie/.virtualenvs/bjoern/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/req.py", line 559, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Users/jamie/.virtualenvs/bjoern/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg/pip/__init__.py", line 249, in call_subprocess
    % (command_desc, proc.returncode))
InstallationError: Command /Users/jamie/.virtualenvs/bjoern/bin/python -c "import setuptools;__file__='/Users/jamie/.virtualenvs/bjoern/build/bjoern/setup.py';execfile(__file__)" install --single-version-externally-managed --record /var/folders/jT/jTsZ5I2lHYODq98s5pizV++++TI/-Tmp-/pip-guk8Dz-record/install-record.txt --install-headers /Users/jamie/.virtualenvs/bjoern/bin/../include/site/python2.6 failed with error code 1

Examples on graceful reloading server process

The example on how to fork server process on multiple core servers. However, is there any way to gracefully stop and restart server processes?

  • block socket to not accept more connections
  • close socket when all the current requests are handled and responses sent
  • close server processes
  • reread configuration files
  • starts new server processes

It would be great if test cases for this feature are added

Thanks

Does not call iterable’s `close` method

Will need to figure out where to stick that close method. I’d like to avoid adding another Request struct member.

Use sendfile for file iterators and provide a wsgi.file_wrapper

infinity waiting

Hello Jonas, all fine?

I installed the web server with http-parser and libev using setup.py but when I run the simple listen.py and try to see in the browser I receber infinity wait, just loading forever.

Python 2.7.1+, Ubunto 10.04

Cya!

can’t install

$ pip install bjoern
my system is centos python2.6.5
/usr/local/bin/pip run on Sun Feb 12 17:10:46 2012
Downloading/unpacking bjoern
  Running setup.py egg_info for package bjoern
    running egg_info
    writing pip-egg-info/bjoern.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/bjoern.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/bjoern.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found
    reading manifest file 'pip-egg-info/bjoern.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/bjoern.egg-info/SOURCES.txt'
Installing collected packages: bjoern
  Running setup.py install for bjoern
    Running command /usr/local/bin/python -c "import setuptools;__file__='/root/build/bjoern/setup.py';exec(compile(open(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install --single
-version-externally-managed --record /tmp/pip-SNmVtv-record/install-record.txt
    running install
    running build
    running build_ext
    building 'bjoern' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/local/include/python2.6 -c http-parser/
http_parser.c -o build/temp.linux-x86_64-2.6/http-parser/http_parser.o -std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -fPIC
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/local/include/python2.6 -c bjoern/wsgi.
c -o build/temp.linux-x86_64-2.6/bjoern/wsgi.o -std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -fPIC
    In file included from bjoern/wsgi.c:1:
    bjoern/common.h:24: warning: function declaration isn’t a prototype
    In file included from bjoern/wsgi.c:3:
    bjoern/filewrapper.h:12: warning: function declaration isn’t a prototype
    In file included from bjoern/wsgi.h:2,
                     from bjoern/wsgi.c:4:
    bjoern/request.h:4:16: error: ev.h: No such file or directory
    In file included from bjoern/wsgi.h:2,
                     from bjoern/wsgi.c:4:
    bjoern/request.h:33: error: expected specifier-qualifier-list before ‘ev_io’
    bjoern/wsgi.c: In function ‘wsgi_call_application’:
    bjoern/wsgi.c:24: error: ‘Request’ has no member named ‘headers’
    bjoern/wsgi.c:25: error: ‘Request’ has no member named ‘headers’
    bjoern/wsgi.c:89: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:90: error: ‘Request’ has no member named ‘iterable’
    bjoern/wsgi.c:91: error: ‘Request’ has no member named ‘iterable’
    bjoern/wsgi.c:93: error: ‘Request’ has no member named ‘iterator’
    bjoern/wsgi.c:97: error: ‘Request’ has no member named ‘iterable’
    bjoern/wsgi.c:98: error: ‘Request’ has no member named ‘iterator’
    bjoern/wsgi.c:99: error: ‘Request’ has no member named ‘iterator’
    bjoern/wsgi.c:106: error: ‘Request’ has no member named ‘headers’
    bjoern/wsgi.c:120: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:120: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:121: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:123: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:145: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:160: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:161: error: ‘Request’ has no member named ‘current_chunk’
    bjoern/wsgi.c:162: error: ‘Request’ has no member named ‘current_chunk_p’
    bjoern/wsgi.c: In function ‘inspect_headers’:
    bjoern/wsgi.c:172: error: ‘Request’ has no member named ‘headers’
    bjoern/wsgi.c:173: error: ‘Request’ has no member named ‘headers’
    bjoern/wsgi.c:185: error: ‘Request’ has no member named ‘state’
    bjoern/wsgi.c:190: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘Py_ssize_t’
    bjoern/wsgi.c: In function ‘wsgi_getheaders’:
    bjoern/wsgi.c:209: error: ‘Request’ has no member named ‘status’

bjoern doesn’t appear to log requests to console for server administrators

I’m unsure whether bjoern logs requests and errors to
standard output and standard error. This information is
handy to server administrators. Could you please
shed some light on whether it does and how one can
access logs?

could’t stop all process, when start server like tests/fork.py

for _ in xrange(NUM_WORKERS):  
    pid = os.fork()
    if pid > 0:
        # in master
        worker_pids.append(pid)
    elif pid == 0:
        # in worker
        try:
            bjoern.run()
        except KeyboardInterrupt:
            pass
        exit()

try:  
    for _ in xrange(NUM_WORKERS):
        os.wait()
except KeyboardInterrupt:  
    for pid in worker_pids:
        os.kill(pid, signal.SIGINT)

when I send KeyboardInterrupt signal by ctrl+c or kill -2 pid, the sever could not stop all the process.

Installation fails on Mac OS X 10.6.

Python 2.7, latest Snow Leopard, libev 3.9 installed via ports. Installed via:

sudo port install libev
virtualenv —no-site-packages —distribute sandbox
cd sandbox ; . bin/activate
pip install bjoern

The result is that ev.h can’t be found and thus a whole slew of errors and warnings are displayed. The version of Python, operating system, and the exact errors/warnings I believe are irrelevant to this problem; ports likely installed libev in /usr/local instead of /usr.

How would I tell pip (or, if I clone the repo, setup.py) to check a different location for includes/libraries?

Python 3 support (PEP 3333)

if someone else volunteers to do this just ask me about it :)

libev error

Hello,

bjoern compiled fine on ubuntu 9.10 but trying hello.py produced the following error.

python2.7: ev.c:2460: ev_signal_start: Assertion `(«libev: signal watchers are only supported in the default loop», loop == ev_default_loop_ptr)’ failed.
Aborted

Good effort starting this project. Would like to see it work out.

J

Benchmark versus uwsgi

How is bjoern performing comparing to uwsgi?
Both of them are written in C.
What are the differences?

Start multiple processes

I’m wondering if there is a way to conveniently start a few processes that can serve requests together. For testing so far I manually create a dozen of sockets and put them in my nginx config.

Since that is working like a charm I’m considering switching to bjoern from gunicorn. I don’t need most of the options and features gunicorn offers, but I like how it spawns a number of processes that share a socket.

I’m happy to implement it myself if a feature like that doesn’t exist yet, but I wanted to make sure I’m not missing something that’s already out there. So far I haven’t found anything…

errors with pip install bjoern

Hi,

I am getting the following error message and would like to be able to install bjoern. I am trying to install it on a Webfaction server so don’t have write access to everythin.

thanks,

Ken Dere

$ pip -v install bjoern
Downloading/unpacking bjoern
Running setup.py egg_info for package bjoern
running egg_info
writing pip-egg-info/bjoern.egg-info/PKG-INFO
writing top-level names to pip-egg-info/bjoern.egg-info/top_level.txt
writing dependency_links to pip-egg-info/bjoern.egg-info/dependency_links.txt
warning: manifest_maker: standard file ‘-c’ not found
reading manifest file ‘pip-egg-info/bjoern.egg-info/SOURCES.txt’
writing manifest file ‘pip-egg-info/bjoern.egg-info/SOURCES.txt’
Installing collected packages: bjoern
Running setup.py install for bjoern
running install
running build
running build_ext
building ‘bjoern’ extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/home/kdere/include -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/local/include/python2.5 -c bjoern/wsgi.c -o build/temp.linux-i686-2.5/bjoern/wsgi.o -std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -fPIC
In file included from bjoern/wsgi.c:1:
bjoern/common.h:13: warning: function declaration isn’t a prototype
In file included from bjoern/wsgi.c:3:
bjoern/wsgi.h:4: warning: function declaration isn’t a prototype
bjoern/wsgi.c: In function ‘inspect_headers’:
bjoern/wsgi.c:188: warning: implicit declaration of function ‘Py_TYPE’
bjoern/wsgi.c:188: error: invalid type argument of ‘->’
bjoern/wsgi.c: At top level:
bjoern/wsgi.h:6: warning: ‘wsgi_iterable_get_next_chunk’ declared inline after being called
bjoern/wsgi.h:6: warning: previous declaration of ‘wsgi_iterable_get_next_chunk’ was here
bjoern/wsgi.c: In function ‘wsgi_iterable_get_next_chunk’:
bjoern/wsgi.c:236: error: invalid type argument of ‘->’
bjoern/wsgi.c: In function ‘start_response’:
bjoern/wsgi.c:282: error: invalid type argument of ‘->’
bjoern/wsgi.c:305: error: invalid type argument of ‘->’
bjoern/wsgi.c:309: error: invalid type argument of ‘->’
bjoern/wsgi.c: At top level:
bjoern/wsgi.c:339: warning: missing initializer
bjoern/wsgi.c:339: warning: (near initialization for ‘StartResponse_Type.tp_str’)
bjoern/wsgi.c:383: warning: function declaration isn’t a prototype
error: command ‘gcc’ failed with exit status 1
Complete output from command /usr/local/bin/python2.5 -c «import setuptools;file=’/home/kdere/build/bjoern/setup.py’;exec(compile(open(file).read().replace(‘rn’, ‘n’), file, ‘exec’))» install —single-version-externally-managed —record /tmp/pip-6G5FIb-record/install-record.txt:
running install

running build

running build_ext

building ‘bjoern’ extension

gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/home/kdere/include -fPIC -DWANT_SENDFILE=1 -DWANT_SIGINT_HANDLING=1 -Ihttp-parser -I/usr/local/include/python2.5 -c bjoern/wsgi.c -o build/temp.linux-i686-2.5/bjoern/wsgi.o -std=c99 -fno-strict-aliasing -Wall -Wextra -Wno-unused -g -fPIC

In file included from bjoern/wsgi.c:1:

bjoern/common.h:13: warning: function declaration isn’t a prototype

In file included from bjoern/wsgi.c:3:

bjoern/wsgi.h:4: warning: function declaration isn’t a prototype

bjoern/wsgi.c: In function ‘inspect_headers’:

bjoern/wsgi.c:188: warning: implicit declaration of function ‘Py_TYPE’

bjoern/wsgi.c:188: error: invalid type argument of ‘->’

bjoern/wsgi.c: At top level:

bjoern/wsgi.h:6: warning: ‘wsgi_iterable_get_next_chunk’ declared inline after being called

bjoern/wsgi.h:6: warning: previous declaration of ‘wsgi_iterable_get_next_chunk’ was here

bjoern/wsgi.c: In function ‘wsgi_iterable_get_next_chunk’:

bjoern/wsgi.c:236: error: invalid type argument of ‘->’

bjoern/wsgi.c: In function ‘start_response’:

bjoern/wsgi.c:282: error: invalid type argument of ‘->’

bjoern/wsgi.c:305: error: invalid type argument of ‘->’

bjoern/wsgi.c:309: error: invalid type argument of ‘->’

bjoern/wsgi.c: At top level:

bjoern/wsgi.c:339: warning: missing initializer

bjoern/wsgi.c:339: warning: (near initialization for ‘StartResponse_Type.tp_str’)

bjoern/wsgi.c:383: warning: function declaration isn’t a prototype

error: command ‘gcc’ failed with exit status 1


Command /usr/local/bin/python2.5 -c «import setuptools;file=’/home/kdere/build/bjoern/setup.py’;exec(compile(open(file).read().replace(‘rn’, ‘n’), file, ‘exec’))» install —single-version-externally-managed —record /tmp/pip-6G5FIb-record/install-record.txt failed with error code 1
Exception information:
Traceback (most recent call last):
File «/home/kdere/lib/python2.5/pip-1.0-py2.5.egg/pip/basecommand.py», line 126, in main
self.run(options, args)
File «/home/kdere/lib/python2.5/pip-1.0-py2.5.egg/pip/commands/install.py», line 228, in run
requirement_set.install(install_options, global_options)
File «/home/kdere/lib/python2.5/pip-1.0-py2.5.egg/pip/req.py», line 1093, in install
requirement.install(install_options, global_options)
File «/home/kdere/lib/python2.5/pip-1.0-py2.5.egg/pip/req.py», line 566, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File «/home/kdere/lib/python2.5/pip-1.0-py2.5.egg/pip/init.py», line 255, in call_subprocess
% (command_desc, proc.returncode))
InstallationError: Command /usr/local/bin/python2.5 -c «import setuptools;file=’/home/kdere/build/bjoern/setup.py’;exec(compile(open(file).read().replace(‘rn’, ‘n’), file, ‘exec’))» install —single-version-externally-managed —record /tmp/pip-6G5FIb-record/install-record.txt failed with error code 1

Problems in start_response with bottle.py

I have some issues running bjoern with bottle.py:

File "..../lib/bottle.py", line 754, in wsgi start_response('500 INTERNAL SERVER ERROR', [('Content-Type', 'text/html')]) File "/usr/lib/python2.7/site-packages/beaker/middleware.py", line 151, in session_start_response return start_response(status, headers, exc_info) TypeError: start_response argument 3 must be a 3-tuple (got 'NoneType' object instead)

I’am not sure if its a problem in bottle.py or your server, even so this workaround fix the issue: http://ramit.in/260d971a85_nl.html

how to log the server?

thanks
and can it serve static files too as fapws?

THIS ISSUE WAS DELETED AND BLOCKED

Problem with query string

«sometimes» in my wsgi application environ i get only part of query string, that was send to server. Can’t see any logic here, sometimes i got all, sometimes only partf of it. Any ideas how to fix that?

Python 2.7.6 ImportError

Arch Linux Python 2.7.6 generates an ImportError for the bjoern module:

Python 2.7.6 (default, Feb 26 2014, 12:07:17) 
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bjoern
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (initbjoern)

Any clues?

Thanks!

*BSD support?

I trid to build this server from source on my FreeBSD8.2 system, but found a problem make this impossible.
Error happened in the «server.c» file.
Because BSD use libc as default, so the <sys/sendfile.h> include will go wrong( this file is a linux feature by glibc).
In BSD,there is a sendfile() function works just the same as in the Linux but has few more parameters.
The do_sendfile() function wrapped the sendfile() function in your code, so I think this make its easier to port to BSD.
Thanks for your excellent job!!

It’s 11 PM on a Wednesday. You’ve just spent three hours toiling on your next Arduino project, and FINALLY, you’re ready to give your sketch a whirl. You hit upload, palms sweaty with anticipation to see all your hard work come to fruition. It’s then you see the error:

No such file or directory.

Surely this is a chance aberration. “Nothing to worry about,” you mutter, sleep-starved and semi-delirious as you hit upload again. And once more, those maddening words, “no such file or directory,” stare back at you in hostile gaslighting mockery.

Have you been here?

If you’re trying to run an Arduino sketch but keep coming across the “no such file or directory” error, don’t worry. This is actually a pretty common problem, and there are two easy fixes that almost always work.

Keep on reading. We’ll show you what they are.

No such file error!

Error messages can be such a pain. They do, however, serve a useful purpose by telling us something about what went wrong. At first glance, the no such file or directory error is particularly maddening because it seems to break that useful purpose rule. Of course there’s a file or directory! You just made the thing, and it’s right there, tucked inside a directory.

But hold up, let’s take a closer look. If you look at the bottom portion of the Arduino IDE where the error message shows up, there’s this handy little button that says “copy error messages.”

Click on that now. You probably won’t fall off your chair to learn that by clicking that button, you just copied the error message from the little window at the bottom of The Serial Monitor’s UI to the clipboard of your computer.

This copy feature is ridiculously useful. You could, for example, paste the error message into Google and learn more about the error. Or you could take advantage of the active Arduino community by asking for help in a forum. For this situation, however, we can be a bit more basic. All we’re going to do is take a closer look at what the message is actually saying. To do that, just fire up your PC’s text editor and paste it into the blank screen.

Decoding the no such file error

Here it is, that pesky error in all its freshly pasted glory.

no such file error printed out on Arduino IDE error section

I’ll break it down for you line by line.

  • The first line is easy. It’s just describing the Arduino version in use, what operating system is running, and which board you have selected.
  • Line 2 begins to zero in on the problem.
    • The first bit, “knob,” is referring to the name of the program. This is your sketch, basically.
    • The second bit is what usually begins to confuse people, but it’s easy once you know. The “10” in this example is telling you the error occurred on line 10 of your sketch. The “19” is telling you the length of the line of code in spaces and characters. The first number is usually the more helpful of the two because you can use it to locate the error in your sketch.
  • Then we get to the smoking gun of the error. It says, “servo.h: No such file or directory”.

So this thing, “Servo.h.” That’s the thing we need to fix, and thanks to line 2, we know where to find it. Line 10. It’s always line 10.

Now that we know what’s going on a bit better, let’s get down to the business of implementing a fix.

The error of our ways

Let’s lay down some scrutiny on this accursed line 10.

It says “#include <servo.h>”

When we verify this code, this line is telling the Arduino IDE compiler, “Hey, for this program to work, you need to go get this file called servo.h”.

Let’s say you had a label-making machine, and you wanted to use it to print some cool motivational labels, like “Success!” and “Keep Trying!” and “Look, Nachos!” To make that happen, you’ll first have to load in a roll of labels. No roll of labels? Well, then the label maker isn’t gonna work.

The sketch you’re trying to upload is like the label maker. The file (in our example, the file named “servo.h”) is the roll of labels.

So the error message actually is saying something useful. It’s saying, “Hey programmer, you said I needed this other file. Well, I looked for it and it’s not there. What gives?”

Now we know the error message isn’t complete gibberish, let’s look at the two most common scenarios that cause it.

Scenario 1 – Fat fingers

This sketch is one that you’ve written. You’re actually the one who wrote the “#include” line. The first thing you should check is your spelling and capitalization. Maybe you spelled the name of the library incorrectly? Or (as with the example below) perhaps you capitalized the wrong letters.

Arduino IDE with misspelled library name, which can create the no such file error

So “servo.h” should actually have a capital “S.” In full and with correct capitalization, it should read, “Servo.h.” You’ll notice above that the word servo changes color when it’s correctly capitalized. That color change signifies that the library name “Servo” is recognized as a “keyword” in the Arduino IDE.

Keep in mind that might not be the case for all the libraries you’re using. In other words, the color change won’t always indicate you’re using the right spelling or capitalization, but it’s often a helpful visual reminder.

Oh, and it’s probably good to mention that everyone in the history of Arduino programming has misspelled or incorrectly capitalized a word at some point. It’s amazing how long you can stare at a line of code and miss something like that.

So don’t sweat it.

Scenario 2 – Missing files

This brings us to the next common scenario for the “no such file or directory” error.

So often, working with Arduinos involves taking code that someone else has developed and shared online and then tailoring it to your project. That’s part of what makes it so easy to get stuff done with Arduino. One problem that frequently happens when we do that, however, is we accidentally introduce code without a matching file.

An easy way to check to see if you have the file a sketch is looking for is to navigate to Sketch > Include Library from within the Arduino IDE. Then look for the name of that library.

Arduino IDE library dropdown - if library is not included, the the no such file error will show up

Whatever library the #include statement was calling for, you want to look through this big long list for a library with the exact same name. If you don’t see the file name there, this means the library isn’t installed. You’ll have to add that library before the sketch will compile without errors.

So, how do you add that library?

The easiest way is to go to Sketch > Include Library > Manage Libraries. The Arduino IDE will open up a dialogue box from which you can search for the library you need.

Make sure you type the exact word that matches the #include line. Once you find the missing library, go ahead and click Install. The Arduino IDE will let you know that it’s installing the library you requested and updating the software accordingly.

Next, just double-check that the library has been successfully installed by going to Sketch > Include Library. You should see your new library in the dropdown list.

Good news! If the library is there, you should now be able to compile your sketch error-free.

Other library locations

OK, there’s one little fly in the ointment. How do these dang ointment flies always manage to complicate things so?

Here’s the thing. Not all libraries live in this convenient pop-up window inside the Arduino IDE. The Arduino community is bubbling with clever ideas, but cleverness (unlike processed cheese) doesn’t always come in conveniently standardized, individually wrapped slices. There are tons of different ways to find Arduino libraries on the web.

If you’re downloading or copying a program from the internet, just go to the page where you got that program and take a close look at the library the author is referencing. They may, for example, have a link to GitHub, which is a place where people keep a lot of code libraries.

Wherever you find it, usually the library will be included in a .zip file package. Once you’ve downloaded the .zip file, fire up the Arduino IDE and go to Sketch > Include Library > Add .ZIP library. Then navigate to the location you downloaded the file and select it. Assuming no additional ointment flies invade your workflow, the Arduino IDE will pop up the message “Library added to your libraries” just above the dark area where the original “no such file or directory” error appeared.

Now it’s business as usual! Just go to Sketch > Include Library, and the new library will appear in the drop-down list.

As the dyslexic Frenchman once said to the oversized violinist: “Viola!”

You now know not one but two ways to add a new library. What a time to be alive!

Review

A quick recap, then.

We’ve looked at the two main scenarios that cause the “no such file or directory” error to appear after you compile your sketch:

  • The fat fingers phenomenon: Check your spelling and capitalization! If you wrote the sketch, there’s a mighty good chance you introduced a tiny error. And don’t beat yourself up over it! Literally every coder has done this.
  • The missing files mixup: Failing that, if you copied code from someone else check that you have the correct libraries installed. Don’t see your library? Install it using the method described above, and you should be good to go.

There may be no such thing as a free lunch, a coincidence, or a luck dragon. But rest assured. Your files and directories? They’re alive and well.

Ошибка «No such file or directory» появляется, когда нужный файл отсутствует.

Давайте исключим самое банальное:

1. Файла нет на диске

user@pc1:~$ cat hello.cpp
cat: hello.cpp: No such file or directory

Поскольку отсутствует файл hello.cpp , то выводится ошибка

2. Кириллица в названии

Проверьте, что в названии файла буква «с» не написана кириллицей. Например в расширении «.cpp».

3. Неправильный путь

Пример из Python

data_file= open ("../text.txt",'r')

«../» в общем случае говорит о том, что файл будет искаться на 1 директорию выше, чем файл с кодом.

Если файл лежит в директории с кодом, то следует писать:

data_file= open ("./text.txt",'r')

4. Неправильная битность

Вы можете увидеть ту же ошибку, если пытаетесь запустить например 64-битное приложение на 32-битной Windows

5. Более экзотические причины.

Причина ошибки может быть самой разной, в зависимости от приложения, которое вы используете.

Если это как раз тот случай, напишите о нем в комментариях, в будущем это очень поможет другим.

Нашли опечатку или ошибку? Выделите её и нажмите Ctrl+Enter

Помогла ли Вам эта статья?

  • #251

Ребят, подскажите, что не так делаю. Плата от Михаила с подсветкой адресными светодиодами. Есть в этой теме в сообщении 219 скетч для ардуинки, для часов с такой подсветкой. Как его правильно прислонить, чтоб заработало?))
Есть все для прошивки Алекса Никсиклок 1.3, ардуинку прошил, все получилось. Пытаюсь открыть этот скетч — при проверке ошибка
(автор библиотек не оставил во вложении)

Arduino: 1.8.10 (Windows 7), Плата:»Arduino Nano, ATmega328P (Old Bootloader)»

timeVersion:43:10: error: Adafruit_NeoPixel.h: No such file or directory

compilation terminated.

exit status 1
Adafruit_NeoPixel.h: No such file or directory

  • #252

Добрый день!
Сперва при проверке писала, что нет библиотеки, когда подгрузи пишет:
Arduino: 1.8.10 (Windows 10), Плата:»Arduino/Genuino Uno»

In file included from D:sketch_jan28asketch_jan28a.ino:1:0:

Несколько библиотек найдено для «SoftwareServo.h»
C:Users������DocumentsArduinolibrariesSoftwareServo/SoftwareServo.h:4:10: fatal error: WProgram.h: No such file or directory

#include <WProgram.h>

^~~~~~~~~~~~

Используется: C:UsersСергейDocumentsArduinolibrariesSoftwareServo
compilation terminated.

exit status 1
Ошибка компиляции для платы Arduino/Genuino Uno.

Этот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
«Показать подробный вывод во время компиляции»

  • #253

@technotrasher, хотел проверить. Не чего в прошивке не менял не трогал. Вылезла ошибка

  • 2B88F639-9497-4455-B9D7-1F360237F238.jpeg

    250.8 KB
    Просмотры: 109

  • 2423F2C7-742F-4583-A97B-169092D366C7.jpeg

    222.1 KB
    Просмотры: 82

technotrasher


  • #254

@technotrasher, хотел проверить. Не чего в прошивке не менял не трогал. Вылезла ошибка

Логично, что не хватает библиотеки.

  • 14.5 KB
    Просмотры: 104

  • #255

@technotrasher, оправь весь список библиотеки. Снова ошибка только другая

  • AFE15AF7-A185-47E3-A52C-D02B36C4232B.jpeg

    188.8 KB
    Просмотры: 48

  • #256

@serg92319, я не программист, но по-моему ты должен всё перенести в корневой каталог любого из имеющихся дисков. Как уже упоминалось ИДЕ не любит кириллицу в пути к своим файлам и скетчам.

  • #258

Добрый вечер.Подскажите как убрать ошибку. Win 7,32-битная, arduino nano

upd^ нашла решение на другом форуме-«Заходишь в инструменты, где нужно выбрать процессор ATmega 328Р- выбираешь: ATmega 328Р(Old Bootloader) и будет тебе счастье. Расскажи другим.»(c)parikmaher72

  • ошибка.JPG

    73.3 KB
    Просмотры: 44

Изменено: 1 Фев 2020

  • #259

Добрый вечер.
~~~
При компиляции скетча, видимо, что то пошло не так, и выдаёт мне ошибку » java.io.IOException: Отказано в доступе «

Для полноты картины: вчера переустанавливала ардуино с более старой версии, на новую. Быть может, я сделала что-то не так?

  • 1580669335239.png

    314.8 KB
    Просмотры: 23

Александр Симонов


  • #260

Добрый вечер.
~~~
При компиляции скетча, видимо, что то пошло не так, и выдаёт мне ошибку » java.io.IOException: Отказано в доступе «

Для полноты картины: вчера переустанавливала ардуино с более старой версии, на новую. Быть может, я сделала что-то не так?

Установи стабильную версию Arduino IDE, а не Hourly Build

  • #261

выдает

In file included from C:UsersUserDownloadsStairs_FinalStairs_Final.ino:1:0:

C:UsersUserDocumentsArduinolibrariesUltrasonic/Ultrasonic.h:11:10: fatal error: WProgram.h: No such file or directory

#include «WProgram.h»

^~~~~~~~~~~~

compilation terminated.

exit status 1
Ошибка компиляции для платы Arduino Nano.

Parovozzzzzzzzz


  • #262

Первый опыт!
А здеся такое….
Уже мозг кипит((((

:Program FilesArduinofirmwareGyverDrink_v1.3GyverDrink_v1.3.ino:67:0: warning: «COLOR_DEBTH» redefined

#define COLOR_DEBTH 2 // цветовая глубина: 1, 2, 3 (в байтах)

In file included from C:Program FilesArduinolibrariesmicroLED/microLED.h:40:0,

from C:Program FilesArduinofirmwareGyverDrink_v1.3GyverDrink_v1.3.ino:60:

C:Program FilesArduinolibrariesmicroLED/ws2812_send.h:37:0: note: this is the location of the previous definition

#define COLOR_DEBTH 3

In file included from C:Program FilesArduinofirmwareGyverDrink_v1.3GyverDrink_v1.3.ino:60:0:

C:Program FilesArduinolibrariesmicroLED/microLED.h:58:1: warning: ‘typedef’ was ignored in this declaration

typedef struct LEDdata {

  • #263

Доброго времени суток, подскажите кто знает, вылезла ошибка при прошивки : #include <FHT.h> //преобразование Хартли . Что я не так сделал?

  • #264

@AlexGyver,
Arduino: 1.8.5 (Windows 7), Плата:»Arduino Nano, ATmega328P (Old Bootloader)»

gyverLight_v1.4:39: error: ‘HIGH_PULL’ was not declared in this scope

GButton touch(BTN_PIN, HIGH_PULL, NORM_OPEN);

^

gyverLight_v1.4:39: error: ‘NORM_OPEN’ was not declared in this scope

GButton touch(BTN_PIN, HIGH_PULL, NORM_OPEN);

^

In file included from C:UsersRedxxxDesktopGyverLight-masterfirmwaregyverLight_v1.4gyverLight_v1.4.ino:41:0:

C:Program Files (x86)ArduinolibrariesFastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.005

# pragma message «FastLED version 3.001.005»

^

C:UsersRedxxxDesktopGyverLight-masterfirmwaregyverLight_v1.4gyverLight_v1.4.ino: In function ‘void setup()’:

gyverLight_v1.4:86: error: ‘class GButton’ has no member named ‘setStepTimeout’

touch.setStepTimeout(50);

^

C:UsersRedxxxDesktopGyverLight-masterfirmwaregyverLight_v1.4gyverLight_v1.4.ino: In function ‘void loop()’:

gyverLight_v1.4:126: error: ‘class GButton’ has no member named ‘isStep’

if (touch.isStep()) {

^

Несколько библиотек найдено для «FastLED.h»
Используется: C:Program Files (x86)ArduinolibrariesFastLED
Не используется: C:Program Files (x86)ArduinolibrariesFastLED-stm32patch
Не используется: C:Program Files (x86)ArduinolibrariesFastLED-3.2.9
exit status 1
‘HIGH_PULL’ was not declared in this scope

Этот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
«Показать подробный вывод во время компиляции»
Что это за ошибка?

  • #265

перерыл интернет в поисках решения но ничего не помогло ! скачивал разные библиотеки серавно не помогло. Суть в том что в проекте используется ИК приемник для этого скачал библиотеку IRremote.h c githab НО как оказалось никаких ошибок нет если в скетче не присутствует слово «tone» которое нужно для пьезо-динамика что делать я вообще не догадываюсь. ВОТ СКЕТЧ БЕЗ СЛОВА «tone» (все работает)

Снимок экрана (15).png

А ВОТ СКЕТЧ СО СЛОВОМ «tone» (c ошибкой)

Снимок экрана (16).png

  • #266

Дело в том, что функция ‘tone()’ использует таймеры (Т0, Т1). Для наны — это пины D4(Т0) и D5(Т1). Попробуйте прописать в скетче
pinMode(4, OUTPUT); , ну и соответственно tone(4, 1100, 100); . ИМХО, в данном скетче место этой функции в теле оператора «if». Ну, сразу после
Serial.println… И да, где же » #include <Arduino.h> » ?

Изменено: 15 Фев 2020

  • #267

@PiratFox, библиотека на месте …..program files 64; Arduino; libaries
«Дело в том, что функция ‘tone()’ использует таймеры (Т0, Т1). Для наны — это пины D4(Т0) и D5(Т1).»
И да, тогда почему без использования библиотеки, функция tone()’ работает на любых цифровых пинах ?

И еще, ошибка не ушла: (проверил на обоих пинах 4,5 )

Снимок экрана (19).png

Изменено: 15 Фев 2020

  • #268

@veniamin, тогда напрашивается логический вывод: функция tone () и библиотека IRemote используют общий аппаратный ресурс, за который и дерутся. А поскольку и tone(), и IRemote имеют дело со временем, опять упираемся в таймер. Только внутренний, а не внешний. Ещё драка может быть за внутренний интеррапт, опять же внутренний таймер. Выходов здесь мне видится два: либо рихтовать библиотеку IRemote, либо написать свою функцию для звука, не задействуя tone(). Как по мне — второе проще и быстрее.

Изменено: 15 Фев 2020

Старик Похабыч


  • #269

почитай описание IR библиотеки у iarduino, может чем то поможет https://iarduino.ru/file/257.html
Я когда вкрячивал в 1 нано серву, IR , лед ленту и часы тоже столкнулся с какой то несовместимостью, сейчас вот не могу вспомнить с какой. В результате оставил как раз указанную выше библиотеку, стандартную для сервы, фастлед и свою недобиблиотеку часов
ЗЫ. Как раз кажется я и отказался от IRremote

  • #270

@PiratFox, спасибо, но разве до меня никто не использовал функцию tone() и библиотеку IRemote, может у кого все получилось поделится решением ?? если таковых нет то и на этом спасибо.

Старик Похабыч


  • #272

я же ссылку дал на другую библиотеку. Айардуинщики пишут свои, я их использовал

  • #273

@PiratFox, спасибо, но разве до меня никто не использовал функцию tone() и библиотеку IRemote, может у кого все получилось поделится решением ?? если таковых нет то и на этом спасибо.

Да может и не получилось ни у кого одновременно эти фишки совместить, как знать… Я как — то давно IRemote использовал в проекте, уж и не помню когда. Проблем таких вроде не было. Видимо, не задействовал tone(). :p

  • #274

@Старик Похабыч,
даже с библиотекой которую вы дали такая-же история: без tone() все нормально, вместе с tone() ошибка.

Старик Похабыч


  • #275

видимо ошибка из-за совместного использования 2-го прерывания, ардуино запрещает совместное использование.
Для простого писка можно попробовать плеер JQ6500, он с крохотной памятью и кроме как писки плюмы его сложно на что то другое использовать.

Ошибка error no such file or directory (Ошибка: нет файла или каталога) возникает на различных устройствах и программах. Разберем возможные решения в некоторых случаях.

В любом случае, в первую очередь обратите внимание на наличие необходимого файла или папки, если он указан в ошибке.

Если ошибка возникает при запуске приложения и после появления ошибки загрузка прекращается, происходет «вылет», вероятно игра или приложение установлена с ошибкой, либо в установочном файле отсутствуют важные компоненты. Если файлы скачаны через торент, проверьте целостность ХЭШа. Для этого кликните на закачку правой кнопкой и нажмите «Пересчитать хэш».

error no such file or directory

Проверьте, соответствует ли разрядность вашей операционной и запускаемого приложения. К примеру, ошибка no such file or directory появится, если вы запускаете программу, предназначенную для 64-х битных систем в 86-битной Windows.

Так же проверьте, есть ли у выполняемой программы или скрипты все необходимые права на чтение и запись. В windows запустите программу от имени администратора.

При написании программ и скриптов обратите внимание на кириллические символы в пути к файлу или папке.

Эта статья очень обобщенная, но вы наверняка пришли с конкретной ошибкой. Просим вас внести свой вклад в сообщество и напишите свою ошибку error no such file or directory и название программы, в которой она возникает в комментариях ниже. Мы постараемся вам помочь.

Понравилась статья? Поделить с друзьями:
  • Bizhub 250 ошибка c2557
  • Bizhub 162 aps size error
  • Bitvision ошибка 400 error
  • Bittorrent ошибка системе не удается найти указанный путь
  • Bitte tanken ошибка фольксваген