Scrapy dmoz tutorial: _init_() takes at most 2 arguments (3 given)
The problem is you're importing "spiders", and using it as your base class. "spiders" is the package that contains the spiders, namely the Spider
class. To use it, use:
from scrapy.spiders import Spider
class dmozspider(Spider):
... # Rest of your code
module._init_() takes at most 2 arguments (3 given) (scrapy tutorial w/ xpath)
You have mistyped scrapy.Item class name.
In items.py
, change:
scrapy.item
to
scrapy.Item
It should look like this:
import scrapy
class DmozItem(scrapy.Item):
title = scrapy.Field()
link = scrapy.Field()
desc = scrapy.Field()
TypeError: _init_() takes exactly 2 arguments (1 given)
You missed the variable dataDir here:
hw = HelloWorld('path/to/your/dir')
Python: __init__() takes 2 positional arguments but 3 were given
I think this is the line that is causing the issue, you cannot pass the self instance to the constructor.
frame = F(self, container)
Can you please check and add more information to the question to understand what you are trying to achieve.
TypeError: __init__() takes 2 positional arguments but 4 were given
Comments inside the code.
from abc import ABCMeta, abstractmethod
class Book(object, metaclass=ABCMeta): # 1. Why do you need meta class?
def __init__(self, title, author):
self.title=title
self.author=author
@abstractmethod
def display(self): pass # 2. Consider replacing with raise NotImplementedError + missing 'self'
class MyBook(Book):
def __init__(self, price, title, author): # 3 You are missing two arguments in here.... (title and author)
super(MyBook, self).__init__(title, author) # 4 This line is missing
self.price = price
def display(self):
print('Title: {}'.format(self.title)) # self missing in all three lines
print('Author: {}'.format(self.author))
print('Price: {}'.format(self.price))
title=input()
author=input()
price=int(input())
new_novel = MyBook(title, author, price)
new_novel.display()
Related Topics
How to Extract Top-Level Domain Name (Tld) from Url
Matplotlib Savefig() Plots Different from Show()
How to Loop Through All But the Last Item of a List
Override a Method at Instance Level
How to Add a Calculated Field to a Django Model
How to Convert a File to Utf-8 in Python
E731 Do Not Assign a Lambda Expression, Use a Def
Simple Python Challenge: Fastest Bitwise Xor on Data Buffers
What's a Faster Operation, Re.Match/Search or Str.Find
Count Unique Values Using Pandas Groupby
Can You Use a String to Instantiate a Class
Meaning of Inter_Op_Parallelism_Threads and Intra_Op_Parallelism_Threads
How to Access the Previous/Next Element in a for Loop
Solving "Dll Load Failed: %1 Is Not a Valid Win32 Application." for Pygame
Inverse Distance Weighted (Idw) Interpolation with Python