I created a simple ERC20 token, and wrote a brownie test for the token. Inside the brownie test I am trying to transfer token from one account to another using transferFrom. I have also given it the approval but it is still showing the error AttributeError: 'NoneType' object has no attribute '_with_attr'.
Do you knwow what the problem might be. Another problem is brownie framework doesn't describe the error in detail, if you can also help with with it on how can get more detail about the error in Brownie.
The brownie test that wrote in given below:
addresses= []
tokens=[]
addresses.append(accounts[1].address)
tokens.append(1000)
coinA.mint(accounts[0].address,1000,{'from':accounts[0]})
print("Balance after Mint: ",coinA.balanceOf(accounts[0].address))
for index,len in enumerate(addresses):
print(addresses[index])
print(tokens[index])
coinA.approve(len,tokens[index],{'from':accounts[0]})
coinA.transferFrom(accounts[0],accounts[1],100,{'from':accounts[0]})
The whole error message is:
coinA.transferFrom(accounts[0],accounts[1],100,{'from':accounts[0]})
E AttributeError: 'NoneType' object has no attribute '_with_attr'
Related
I started working with Pyrebase recently and it's been going smoothly. However, today, I started getting an error from an update statement that I wasn't getting before.
I didn't change anything in the code.
The statement triggering the TypeError is:
db.child("teams").child(x['creatorId']).update({'player01':creator_name,'player02':str(request)})
'creatorId' is a key from a dictionary I've saved in a JSON file. In a previous step, I ran a loop to get the value of creatorId, which is what I'm using here.
creator_name is a discord username (username#discriminator):
creator = bot.get_user(x['creatorId'])
creator_name = creator.name + "#" + creator.discriminator
request is also a discord username: request = bot.get_user(payload.user_id). I'm using str() here because it doesn't let me update Firebase with a Member object, and therefore, I have to turn request (which is a Discord username) into a string.
The error is:
TypeError: 'Pyre' object is not subscriptable
Also, I'm running the code on Repl.it, and a few times before, Repl.it showed me errors where none were there, so that may also be a cause. But that usually solved itself when I refreshed the page. This error does not solve itself like that.
Any and all help is appreciated. Please let me know if I've forgotten any important details.
Ok, figured it out.
What I did was this:
I created a new variable to store x['CreatorId']:
creator_id = x['creatorId']
Afterwards, I replaced the x['creatorId'] in the update statement with the new variable. So, the new code looks like this:
db.child('teams').child(creator_id).update({'player01':creator_name,'player02':str(request)})
I would like to reproduce the following tutorial, but when I tried to get the robot references theres always this Error:
"AttributeError: 'CartpoleRobot' object has no attribute 'getSelf'"
I rebuild this Tutorial: https://github.com/aidudezzz/deepbots-tutorials/blob/master/robotSupervisorSchemeTutorial/README.md
In other controllers I get similar error messages when I try to get the robot references. I think the error is in the communication between the robot simulation and the controller.
I have tried importing the supervisor and getting the functions via supervisor.get. But here comes another error: "Only one instance of the Robot class should be created"
However, I am new to webots and robotics/informatics in general. Any help would be greatly appreciated!
The whole Error with Traceback:
INFO: robotSupervisorController: Starting controller: python.exe -u robotSupervisorController.py
Traceback (most recent call last):
File "D:\Webots Projekte\controllers\robotSupervisorController\robotSupervisorController.py", line 88, in <module>
env = CartpoleRobot()
File "D:\Webots Projekte\controllers\robotSupervisorController\robotSupervisorController.py", line 16, in __init__
self.robot = self.getSelf() # Grab the robot reference from the supervisor to access various robot methods
AttributeError: 'CartpoleRobot' object has no attribute 'getSelf'
WARNING: 'robotSupervisorController' Controller beendet mit Status: 1
The Code is the same than shown in the Tutorial.
The short section that generates the error:
self.robot = self.getSelf() # Grab the robot reference from the supervisor to access various robot methods
self.positionSensor = self.getDevice("polePosSensor")
self.positionSensor.enable(self.timestep)
If I comment out the first one, the next line returns a similar error
Every answer is highly appreciated! Thanks!
I had the same issue. I use the deepbots-0.1.2 and webotsR2021a.
Try to uninstall the deepbots and then install them using the:
pip install -i https://test.pypi.org/simple/ deepbots
the code is as follows :
iterator = tf.compat.v1.data.make_one_shot_iterator(batched_dataset)
handle = iterator.string_handle()
i try to run a Captcha crack code which is this github project and despite the fact that i had to modify so many parts of the code for compatibility issues i face this error and the error says :
AttributeError: 'OwnedIterator' object has no attribute 'string_handle'
i have been trying for more than 1 day and couldn't and can't find any solution to this issue hope someone help me run the code with No Error!
i am using Pycharm and python and Tensorflow version = 2.4.1
Impacted versions: Odoo10c
Steps to reproduce:
i am using demo database
go to menu Inventory/All Transfers
create new picking, choose any picking type (I choose delivery order)
input items
Save
click Edit
choose one of items and change to other product
Current behavior:
if using Google Chrome, It will raise error warning Error: QWeb2 - template['CrashManager.warning']: Runtime Error: TypeError: Cannot read property 'data' of undefined
if using Firefox, error will become TypeError: d.error is undefined
Expected behavior:
no error
Video/Screenshot link (optional):
I faced same issue on my older version of Odoo10.
Try with updated revision of Odoo10 and error will gone.
I wrote a simple script for identifying users who contribute to certain subreddits. As a disclaimer, if you plan on using this code you should be sure to anonymize the data (as I will, by aggregating data and removing all usernames). It works with certain subreddits but does not seem to be very robust, as seen by the following error I get when I run it with /r/nba:
AttributeError: 'NoneType' object has no attribute 'get_comments'
Below is my code:
import praw
import pprint
users = [] #[username, flair, comments]
r=praw.Reddit(user_agent="user_agent")
r.login("username", "password")
submissions = r.get_subreddit('nba').get_top(limit=1) #won't work with higher limit?
for submission in submissions:
submission.replace_more_comments(limit=3, threshold=5)
flat_comments = praw.helpers.flatten_tree(submission.comments)
for comment in flat_comments:
user_comments = []
for i in comment.author.get_comments(limit=2):
user_comments.append(i.body)
#user_comments.append(str(i.body)) #sometimes causes an error as well
users.append([str(comment.author), comment.author_flair_text, user_comments])
pprint.pprint(users)
When I change the subreddit to 'python' it seems to encounter less problems, so hopefully someone can point out what I'm missing. Thanks in advance!
Ok, so you see the line
for i in comment.author.get_comments(limit=2):
I presume your code is failing because
comment.author is None