$ sudo pip install pypcap
Downloading/unpacking pypcap
Downloading pypcap-1.1.4.tar.gz (41kB): 41kB downloaded
Running setup.py (path:/tmp/user/0/pip_build_root/pypcap/setup.py) egg_info for package pypcap
Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h
Found libraries in None
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>
lib_file = os.path.basename(lib_file_path)
File "/usr/lib/python2.7/posixpath.py", line 121, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
Complete output from command python setup.py egg_info:
Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h
Found libraries in None
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>
lib_file = os.path.basename(lib_file_path)
File "/usr/lib/python2.7/posixpath.py", line 121, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/user/0/pip_build_root/pypcap
Storing debug log for failure in /home/<redacted>/.pip/pip.log
/home//.pip/pip.log
------------------------------------------------------------
/usr/bin/pip run on Fri Oct 30 20:53:28 2015
Downloading/unpacking pypcap
Getting page https://pypi.python.org/simple/pypcap/
URLs to search for versions for pypcap:
* https://pypi.python.org/simple/pypcap/
Analyzing links from page https://pypi.python.org/simple/pypcap/
Skipping https://pypi.python.org/packages/2.7/p/pypcap/pypcap-1.1.4-cp27-none-macosx_10_10_x86_64.whl#md5=ca7a6a3956f332a29666682ad3996001 (from https://pypi.python.org/simple/pypcap/) because it is not compatible with this Python
Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.1.tar.gz#md5=d32f422feba022dad219edb1e7de0366 (from https://pypi.python.org/simple/pypcap/), version: 1.1.1
Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.2.tar.gz#md5=c11ecfd60152ee1039cbc59f537d84ce (from https://pypi.python.org/simple/pypcap/), version: 1.1.2
Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.3.tar.gz#md5=b1c43d8959123c2d4fa8a1531e0d61ca (from https://pypi.python.org/simple/pypcap/), version: 1.1.3
Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.4.tar.gz#md5=e2ded33e75d94e4635798a2b2f4aaea1 (from https://pypi.python.org/simple/pypcap/), version: 1.1.4
Found link https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.tar.gz#md5=d42e03b9cc322b1d3f39847752368f0d (from https://pypi.python.org/simple/pypcap/), version: 1.1
Using version 1.1.4 (newest of versions: 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1)
Downloading from URL https://pypi.python.org/packages/source/p/pypcap/pypcap-1.1.4.tar.gz#md5=e2ded33e75d94e4635798a2b2f4aaea1 (from https://pypi.python.org/simple/pypcap/)
Running setup.py (path:/tmp/user/0/pip_build_root/pypcap/setup.py) egg_info for package pypcap
Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h
Found libraries in None
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>
lib_file = os.path.basename(lib_file_path)
File "/usr/lib/python2.7/posixpath.py", line 121, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
Complete output from command python setup.py egg_info:
Found pcap headers in /usr/src/linux-headers-3.16.0-43-generic/include/config/touchscreen/pcap.h
Found libraries in None
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/user/0/pip_build_root/pypcap/setup.py", line 60, in <module>
lib_file = os.path.basename(lib_file_path)
File "/usr/lib/python2.7/posixpath.py", line 121, in basename
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
----------------------------------------
Cleaning up...
Removing temporary dir /tmp/user/0/pip_build_root...
Command python setup.py egg_info failed with error code 1 in /tmp/user/0/pip_build_root/pypcap
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 715, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/user/0/pip_build_root/pypcap
Я пытаюсь скомпилировать некоторые .less
файлы с использованием django-pipeline
. Когда я бегу collectstatic
, все копируется правильно, а потом я получаю эту ошибку:
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_manager(settings)
File ".../lib/python2.7/site-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File ".../lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File ".../lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File ".../lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File ".../lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
return self.handle_noargs(**options)
File ".../lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 163, in handle_noargs
collected = self.collect()
File ".../lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 119, in collect
dry_run=self.dry_run)
File ".../lib/python2.7/site-packages/pipeline/storage.py", line 26, in post_process
output_file = packager.pack_stylesheets(package)
File ".../lib/python2.7/site-packages/pipeline/packager.py", line 90, in pack_stylesheets
variant=package.variant, **kwargs)
File ".../lib/python2.7/site-packages/pipeline/packager.py", line 99, in pack
paths = self.compile(package.paths)
File ".../lib/python2.7/site-packages/pipeline/packager.py", line 93, in compile
return self.compiler.compile(paths)
File ".../lib/python2.7/site-packages/pipeline/compilers/__init__.py", line 34, in compile
compiled_content = compiler.compile_file(content, finders.find(path))
File ".../lib/python2.7/site-packages/pipeline/compilers/less.py", line 19, in compile_file
cwd = os.path.dirname(path)
File ".../lib64/python2.7/posixpath.py", line 120, in dirname
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
Я не думаю, что сделал что-то странное с типами в моем settings.py
, но вот соответствующий фрагмент на всякий случай:
STATICFILES_STORAGE = "pipeline.storage.PipelineCachedStorage"
PIPELINE = True
STATICFILES_DIRS = (
("projectname", os.path.join(REPO_ROOT, "static")),
)
PIPELINE_COMPILERS = (
'pipeline.compilers.coffee.CoffeeScriptCompiler',
'pipeline.compilers.less.LessCompiler'
)
PIPELINE_JS = {
'projectname': {
'source_filenames': ('js/*.coffee',),
'output_filename': 'projectname/js.js'
}
}
PIPELINE_CSS = {
'projectname': {
'source_filenames': ('css/style.less',),
'output_filename': 'projectname/css.css'
}
}
Если я заменю свой CSS source_filenames
с шариком (т.е. css/*.less
) У меня тот же результат. Файл определенно находится там, где я говорю (по крайней мере, если я заменю его на путь, который, как я знаю, неверен, я получу другую ошибку). С PIPELINE_CSS
строки закомментированы, мой CoffeeScript отлично компилируется в JS. Любые идеи?
- Start
- Prev
- 1
- Next
- End
- 1
- rbarry1068
-
Offline
- New Member
More
11 Mar 2017 02:45 — 11 Mar 2017 02:50 #89396
by rbarry1068
Getting error ‘NoneType’ object has no attribute ‘rfind’ when Axis starts was created by rbarry1068
I am running LinuxCNC 2.7.8. When Axis starts, it looks fine, but I get the error ‘NoneType’ object has no attribute ‘rfind’ and can’t get a preview of my g-code file. Any Ideas would be welcome.
Last edit: 11 Mar 2017 02:50 by rbarry1068.
Please Log in or Create an account to join the conversation.
- dgarrett
-
Offline
- Platinum Member
More
11 Mar 2017 03:08 — 11 Mar 2017 03:19 #89399
by dgarrett
Replied by dgarrett on topic Getting error ‘NoneType’ object has no attribute ‘rfind’ when Axis starts
Your ini file has two [RS274NGC] sections one with SUBROUTINE_PATH, one with PARAMETER_FILE
Try using a single [RS274NGC] with both items
Last edit: 11 Mar 2017 03:19 by dgarrett.
The following user(s) said Thank You: Joebmh, MDM3D
Please Log in or Create an account to join the conversation.
- rbarry1068
-
Offline
- New Member
More
15 Mar 2017 00:37 #89642
by rbarry1068
Replied by rbarry1068 on topic Getting error ‘NoneType’ object has no attribute ‘rfind’ when Axis starts
Thanks. That fixed it.
Please Log in or Create an account to join the conversation.
- Start
- Prev
- 1
- Next
- End
- 1
Мой код выдает исключение, но поиск в Google мне не помог. Я проверил ошибку, возможно, он получил неправильный путь, но он выводит правильный путь на консоль.
Exception Value:
‘NoneType’ object has no attribute ‘rfind’
def user_directory_path(instance, filename):
time_stamp = 'user_{0}/{1}'.format(instance.user, filename)
createfolder = os.path.join('home', 'ttt', 'Desktop', 'GolemProject', 'Fileuploads', time_stamp,)
print(createfolder)
if not os.path.exists(createfolder):
os.makedirs(createfolder)
С консоли:
home/ttt/Desktop/GolemProject/Fileuploads/user_wqe/vbbfgsfdgfds.zip
Internal Server Error: /callgolem/
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ttt/Desktop/GolemProject/callgolem/views.py", line 65, in index
instance.save()
File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 729, in save
force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 759, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 842, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 880, in _do_insert
using=using, raw=raw)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 1125, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1283, in execute_sql
for sql, params in self.as_sql():
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1236, in as_sql
for obj in self.query.objs
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1236, in <listcomp>
for obj in self.query.objs
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1235, in <listcomp>
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1185, in pre_save_val
return field.pre_save(obj, add=True)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/files.py", line 287, in pre_save
file.save(file.name, file.file, save=False)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/files.py", line 86, in save
name = self.field.generate_filename(self.instance, name)
File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/files.py", line 306, in generate_filename
return self.storage.generate_filename(filename)
File "/usr/local/lib/python3.5/dist-packages/django/core/files/storage.py", line 97, in generate_filename
dirname, filename = os.path.split(filename)
File "/usr/lib/python3.5/posixpath.py", line 103, in split
i = p.rfind(sep) + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
#8517
closed
defect
(wontfix)
AttributeError: ‘NoneType’ object has no attribute ‘rfind’
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | 0.11.5rc2 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
How to Reproduce
While doing a POST operation on /build/installer/5893
, Trac issued an internal error.
(please provide additional details here)
Request parameters:
{'__FORM_TOKEN': u'2188023fbf669d8095110f1f', 'action': u'invalidate', 'config': u'installer', 'id': u'5893'}
User Agent was: Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.0.11) Gecko/20080528 Fedora/2.24.3-7.fc10 Epiphany/2.22 Firefox/3.0
System Information
Trac | 0.11.5rc2
|
Python | 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) [GCC 4.3.2 20080917 (Red Hat 4.3.2-4)]
|
setuptools | 0.6c2
|
psycopg2 | 2.0.11
|
Genshi | 0.6dev-r1063
|
Bitten | 0.6dev-r657
|
Subversion | 1.5.4 (r33841)
|
RPC | 1.0.6
|
jQuery: | 1.2.6
|
Python Traceback
Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Trac-0.11.5rc2-py2.5.egg/trac/web/main.py", line 444, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.5rc2-py2.5.egg/trac/web/main.py", line 205, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Bitten-0.6dev_r657-py2.5.egg/bitten/web_ui.py", line 473, in process_request self._do_invalidate(req, build, db) File "/usr/lib/python2.5/site-packages/Bitten-0.6dev_r657-py2.5.egg/bitten/web_ui.py", line 612, in _do_invalidate step.delete(db=db) File "/usr/lib/python2.5/site-packages/Bitten-0.6dev_r657-py2.5.egg/bitten/model.py", line 575, in delete log.delete(db=db) File "/usr/lib/python2.5/site-packages/Bitten-0.6dev_r657-py2.5.egg/bitten/model.py", line 734, in delete log_file = self.get_log_file(log_file[0]) File "/usr/lib/python2.5/site-packages/Bitten-0.6dev_r657-py2.5.egg/bitten/model.py", line 716, in get_log_file if filename != os.path.basename(filename): File "/usr/lib/python2.5/posixpath.py", line 112, in basename return split(p)[1] File "/usr/lib/python2.5/posixpath.py", line 77, in split i = p.rfind('/') + 1 AttributeError: 'NoneType' object has no attribute 'rfind'
Я пытаюсь определить расширение файла, используя os.path.splitext
вот мой код:
for emailid in msgs:
typ, s = mail.fetch(emailid, "(RFC822)")
m = email.message_from_string(s[0][1])
result = re.findall(pattern,str)
if result:
for part in m.walk():
filename = part.get_filename()
if filename:
extension = os.path.splitext(fileName)
if extension[1][1:] == 'csv':
### Process into a dataframe
df = pd.read_csv(StringIO(filename))
здесь приведено сообщение об ошибке с IPython:
#### Begin error Message #####
AttributeError Traceback (most recent call last)
<ipython-input-83-71fabd157c43> in <module>()
40 if filename:
41 print type(filename)
---> 42 extension = os.path.splitext(fileName)
43 if extension[1][1:] == 'csv':
44 ### Process into a dataframe
C:Anaconda2libntpath.pyc in splitext(p)
198
199 def splitext(p):
--> 200 return genericpath._splitext(p, sep, altsep, extsep)
201 splitext.__doc__ = genericpath._splitext.__doc__
202
C:Anaconda2libgenericpath.pyc in _splitext(p, sep, altsep, extsep)
97 leading dots. Returns "(root, ext)"; ext may be empty."""
98
---> 99 sepIndex = p.rfind(sep)
100 if altsep:
101 altsepIndex = p.rfind(altsep)
AttributeError: 'NoneType' object has no attribute 'rfind'
#### End Error message #####
NoneType должен означать, что я ничего не пропускаю, когда печатаю тип (имя файла), я получаю:
как передать файл, чтобы определить расширение, а затем создать dataframe? мне нужно сохранить на диск
это будет для синтаксического анализа script, который регулярно рассылается по электронной почте csv’ed, поэтому регулярное выражение определяет, какое правило следует следовать.