IndentationError: expected an indented block, Scrapy - scrapy

career#careercrawler:~/stack/stack$ scrapy crawl stack
Traceback (most recent call last): File
"/home/career/.local/bin/scrapy", line 11, in
sys.exit(execute())
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/cmdline.py",
line 141, in execute
cmd.crawler_process = CrawlerProcess(settings)
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/crawler.py",
line 238, in init
super(CrawlerProcess, self).init(settings)
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/crawler.py",
line 129, in init
self.spider_loader = _get_spider_loader(settings)
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/crawler.py",
line 325, in _get_spider_loader
return loader_cls.from_settings(settings.frozencopy())
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/spiderloader.py",
line 33, in from_settings
return cls(settings)
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/spiderloader.py",
line 20, in init
self._load_all_spiders()
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/spiderloader.py",
line 28, in _load_all_spiders
for module in walk_modules(name):
File
"/home/career/.local/lib/python2.7/site-packages/scrapy/utils/misc.py",
line 71, in walk_modules
submod = import_module(fullpath)
File "/usr/lib/python2.7/importlib/init.py", line 37, in
import_module
import(name)
File "/home/career/stack/stack/spiders/stack_spider.py", line 4, in
from stack.items import StackItem
File "/home/career/stack/stack/items.py", line 13
title = scrapy.Field()
^
IndentationError: expected an indented block
This is my error, I don't know what is happening there. Someone help me, please.

This error is because of intention,
As mentioned in the traceback:
/home/career/stack/stack/items.py", line 13 title = scrapy.Field()
go to ~/stack/stack/items.py and check indentation at line 13.

Related

Spyder can't launch

My Spyder crashes while lauching it. It's never successfully opened
PermissionError: [Errno 13] Permission denied: '/Users/macbookair/.config/pylintrc'
Detailed Error:
Traceback (most recent call last): File "/Users/macbookair/anaconda3/bin/spyder", line 11, in sys.exit(main()) File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/app/start.py", line 252, in main mainwindow.main(options, args) File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1956, in main mainwindow = create_window(MainWindow, app, splash, options, args) File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/app/utils.py", line 289, in create_window main.setup() File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 736, in setup internal_plugins = find_internal_plugins() File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/app/find_plugins.py", line 40, in find_internal_plugins mod = importlib.import_module(entry_point.module_name) File "/Users/macbookair/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/plugins/pylint/plugin.py", line 22, in from spyder.plugins.pylint.confpage import PylintConfigPage File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/plugins/pylint/confpage.py", line 16, in from spyder.plugins.pylint.main_widget import (MAX_HISTORY_ENTRIES, File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/plugins/pylint/main_widget.py", line 35, in from spyder.plugins.pylint.utils import get_pylintrc_path File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/spyder/plugins/pylint/utils.py", line 16, in import pylint.config File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/pylint/config/__init__.py", line 27, in from pylint.config.environment_variable import PYLINTRC File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/pylint/config/environment_variable.py", line 11, in PYLINTRC = find_pylintrc() File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/pylint/config/find_default_config_files.py", line 94, in find_pylintrc for config_file in find_default_config_files(): File "/Users/macbookair/anaconda3/lib/python3.9/site-packages/pylint/config/find_default_config_files.py", line 76, in find_default_config_files if home_rc.is_file(): File "/Users/macbookair/anaconda3/lib/python3.9/pathlib.py", line 1456, in is_file return S_ISREG(self.styour textat().st_mode) File "/Users/macbookair/anaconda3/lib/python3.9/pathlib.py", line 1232, in stat return self._accessor.stat(self) PermissionError: [Errno 13] Permission denied: '/Users/macbookair/.config/pylintrc'
Did anyone meet this problem too?
(Spyder maintainer here) This problem will be fixed in Spyder 5.4.1, to be released before the end of 2022.

pyshark "TypeError: sequence item 6: expected str instance, _io.TextIOWrapper found"

I am using pyshark for live packet capture. when I pass a parameter output_file = myFilObject for saving captures to a file,
getting following error on sniffing line. If output_file parameter is removed, this works absolutely fine. Please suggest.
MySampleCode:
import pyshark
def capturePacket():
outputF = open('capturepcap.pcap', 'w')
cap = pyshark.LiveCapture(interface='Ethernet 8', output_file=outputF)
cap.sniff(timeout=60)
outputF.close()
Error:
Traceback (most recent call last):
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\Users\wxyz\.vscode\extensions\ms-python.python-2022.6.2\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\wxyz\.vscode\extensions\ms-python.python-2022.6.2\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\wxyz\.vscode\extensions\ms-python.python-2022.6.2\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 269, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\Users\wxyz\Documents\automation\practice_set_script\paket_capture\basic_packetCapture.py", line 29, in <module>
capturePacket()
File "c:\Users\wxyz\Documents\automation\practice_set_script\paket_capture\basic_packetCapture.py", line 22, in capturePacket
cap.sniff(timeout=60)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\site-packages\pyshark\capture\capture.py", line 137, in load_packets
self.apply_on_packets(keep_packet, timeout=timeout, packet_count=packet_count)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\site-packages\pyshark\capture\capture.py", line 274, in apply_on_packets
return self.eventloop.run_until_complete(coro)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
return future.result()
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 445, in wait_for
return fut.result()
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\site-packages\pyshark\capture\capture.py", line 283, in packets_from_tshark
tshark_process = await self._get_tshark_process(packet_count=packet_count)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\site-packages\pyshark\capture\live_capture.py", line 94, in _get_tshark_process
tshark = await super(LiveCapture, self)._get_tshark_process(packet_count=packet_count, stdin=read)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\site-packages\pyshark\capture\capture.py", line 399, in _get_tshark_process
self._log.debug("Creating TShark subprocess with parameters: " + " ".join(parameters))
TypeError: sequence item 6: expected str instance, _io.TextIOWrapper found
Error on reading from the event loop self pipe
loop: <ProactorEventLoop running=True closed=False debug=False>
Traceback (most recent call last):
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 779, in _loop_self_reading
f = self._proactor.recv(self._ssock, 4096)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 450, in recv
self._register_with_iocp(conn)
File "C:\Users\wxyz\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 723, in _register_with_iocp
_overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0)
OSError: [WinError 87] The parameter is incorrect
PS C:\Users\wxyz\Documents\automation\practice_set_script\paket_capture>
The issue in your code is these lines:
outputF = open('capturepcap.pcap', 'w')
cap = pyshark.LiveCapture(interface='Ethernet 8', output_file=outputF)
The output_file parameter is a string and not a io.TextIOWrapper
:param output_file: A string of a file to write every read packet into (useful when filtering).
So this works:
import pyshark
def capturePacket():
cap = pyshark.LiveCapture(interface='en0', output_file='capturepcap.pcap')
cap.sniff(timeout=60)
capturePacket()
Here is a reference that I put together on using PyShark

Blender throws keyframe error when exporting as gltf (glb) file with animations - Key.path_resolve could not be resolved

I am pretty new to blender, animations and gltf. I have successfully created my 3d model and was able to export that as glb file. Currently, I am trying to add a walking animation but the export to gltf with animations doesn't work. This is the error that the exporter is throwing:
Python: Traceback (most recent call last):
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\__init__.py", line 575, in execute
return gltf2_blender_export.save(context, export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 46, in save
json, buffer = __export(export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 63, in __export
__gather_gltf(exporter, export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 72, in __gather_gltf
active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 39, in gather_gltf2
animations += __gather_animations(blender_scene, export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 83, in __gather_animations
animations_, merged_tracks = gltf2_blender_gather_animations.gather_animations(_blender_object, merged_tracks, len(animations), export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animations.py", line 76, in gather_animations
animation = __gather_animation(blender_action, blender_object, export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animations.py", line 114, in __gather_animation
channels=__gather_channels(blender_action, blender_object, export_settings),
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animations.py", line 150, in __gather_channels
blender_action, blender_object, export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 65, in wrapper_cached
result = func(*args)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_channels.py", line 83, in gather_animation_channels
None)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_channels.py", line 202, in __gather_animation_channel
sampler=__gather_sampler(channels, blender_object, export_settings, bake_bone, bake_channel, bake_range_start, bake_range_end, action_name, driver_obj),
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_channels.py", line 263, in __gather_sampler
export_settings
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 65, in wrapper_cached
result = func(*args)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_samplers.py", line 65, in gather_animation_sampler
bake_bone, bake_channel, bake_range_start, bake_range_end, action_name, driver_obj, export_settings),
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 65, in wrapper_cached
result = func(*args)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_samplers.py", line 240, in __gather_input
export_settings)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 65, in wrapper_cached
result = func(*args)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_sampler_keyframes.py", line 240, in gather_keyframes
step
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 90, in wrapper_bonecache
result = func(*args)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_animation_sampler_keyframes.py", line 177, in get_bone_matrix
drivers_to_manage = get_sk_drivers(obj_driver)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 117, in wrapper_skdriverdiscover
result = func(*args)
File "E:\Applications\Blender\2.92\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_drivers.py", line 54, in get_sk_drivers
sk_name = child.data.shape_keys.path_resolve(get_target_object_path(sk_c.data_path)).name
ValueError: Key.path_resolve("key_blocks["Key 1"]") could not be resolved
location: <unknown location>:-1
I suppose that the gltf exporter can't find my keyframes, but I have no clue on how to fix that issue.
Any help is much appreciated!
Thanks
I have submitted a bug report for the gltf exporter. You can look at it here: https://github.com/KhronosGroup/glTF-Blender-IO/issues/1401
Removing invalid drivers fixes the issue.

Scrapy calling spider other than the one specified on the command line

(P6Svenv)malikarumi#Tetuoan2:~/Projects/P6/P6Svenv/test2/test2/spiders$ scrapy crawl zomd
Traceback (most recent call last):
File "/usr/bin/scrapy", line 9, in <module>
load_entry_point('Scrapy==1.0.3.post6-g2d688cd', 'console_scripts', 'scrapy')()
File "/usr/lib/pymodules/python2.7/scrapy/cmdline.py", line 142, in execute
cmd.crawler_process = CrawlerProcess(settings)
File "/usr/lib/pymodules/python2.7/scrapy/crawler.py", line 209, in __init__
super(CrawlerProcess, self).__init__(settings)
File "/usr/lib/pymodules/python2.7/scrapy/crawler.py", line 115, in __init__
self.spider_loader = _get_spider_loader(settings)
File "/usr/lib/pymodules/python2.7/scrapy/crawler.py", line 296, in _get_spider_loader
return loader_cls.from_settings(settings.frozencopy())
File "/usr/lib/pymodules/python2.7/scrapy/spiderloader.py", line 30, in from_settings
return cls(settings)
File "/usr/lib/pymodules/python2.7/scrapy/spiderloader.py", line 21, in __init__
for module in walk_modules(name):
File "/usr/lib/pymodules/python2.7/scrapy/utils/misc.py", line 71, in walk_modules
submod = import_module(fullpath)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/malikarumi/Projects/P6/P6Svenv/test2/test2/spiders/t350_crawl.py", line 36
def parse_item(self, response):
^
IndentationError: unindent does not match any outer indentation level
Do you see it? Scrapy isn't even calling the spider I specified on the command line!
I see that super in the traceback, but all my t350's are derived from CrawlSpider. zomd is subclassed from scrapy.Spider. Why is this happening and what do I do about it?
Spider's name doesn't equal to the file name. It is defined within the spider file by the second line below:
class CAPjobSpider(Spider):
name = "spider_name"
The above spider's name is "spider_name", even if the file may be "New_York.py".

KeyError: 'active_id' openerp

I've changed record rules for project purpose after that when I click on "My Current Time sheet throwing below error
Client Traceback (most recent call last):
File "F:\OpenERP 7.0-20140118-002423\Server\server\openerp\addons\web\http.py", line 204, in dispatch
File "F:\OpenERP 7.0-20140118- 002423\Server\server\openerp\addons\web\controllers\main.py", line 1432, in run
File "F:\OpenERP 7.0-20140118-002423\Server\server\openerp\addons\web\session.py", line 42, in proxy
File "F:\OpenERP 7.0-20140118-002423\Server\server\openerp\addons\web\session.py", line 30, in proxy_method
File "F:\OpenERP 7.0-20140118-002423\Server\server\openerp\addons\web\session.py", line 103, in send
Server Traceback (most recent call last):
File "F:\OpenERP 7.0-20140118-002423\Server\server\openerp\addons\web\session.py", line 89, in send
File "F:\OpenERP 7.0-20140118-002423\Server\server.\openerp\netsvc.py", line 292, in dispatch_rpc
File "F:\OpenERP 7.0-20140118-002423\Server\server.\openerp\service\web_services.py", line 626, in dispatch
File "F:\OpenERP 7.0-20140118-002423\Server\server.\openerp\osv\osv.py", line 190, in execute_kw
File "F:\OpenERP 7.0-20140118-002423\Server\server.\openerp\osv\osv.py", line 132, in wrapper
File "F:\OpenERP 7.0-20140118-002423\Server\server.\openerp\osv\osv.py", line 199, in execute
File "F:\OpenERP 7.0-20140118-002423\Server\server.\openerp\osv\osv.py", line 187, in execute_cr
File "F:\OpenERP 7.0-20140118- 002423\Server\server\openerp\addons\smsclient\serveraction.py", line 47, in run
KeyError: 'active_id'
Once if you give record rule with domain_force condition, it will store in your db (ir.rule) . Even comment/remove that code, it will work.
You've to make that condition as empty []. Then upgrade the respective module. it will work..
Example:
[('employee_id.user_id', '=', user.id)]
if you want to remove the domain_force give like this:
[]
Then upgrade, and comment/remove that respective line