findNotesMetadata AttributeError: 'function' object has no attribute 'write' - python

Found similar questions to this, but the solutions proposed didn't seem to work for me.
I'm struggling to make the findNotesMetadata call. My getUser() from the userStore works, and my createNote from the notestore works as well. It is only the call to findNotesMetaData that is failing currently.
from evernote.api.client import EvernoteClient
import evernote.edam.type.ttypes as Types
dev_token = "blah blah blah"
client = EvernoteClient(token=dev_token, sandbox=True)
userStore = client.get_user_store()
user = userStore.getUser()
print user.username
notestore = client.get_note_store()
notebooks = notestore.listNotebooks()
note = Types.Note()
note.title = "I'm a test note!"
note.content = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">'
note.content += '<en-note><en-todo/>Hello, world!</en-note>'
note = noteStore.createNote(note)
tags = notestore.listTags()
CheckedTags = set()
for tag in tags:
if tag.name[0:4] == "CheckThisTag":
print tag
CheckedTags.add(tag.guid)
print CheckedTags
myfilter = notestore.NoteFilter()
spec = notestore.NotesMetadataResultSpec()
spec.includeTitle = True
notes = notestore.findNotesMetadata(dev_token, myfilter, 0, 100, spec)
print notes
Running this code gets me the following error on the findNotesMetaData line
Traceback (most recent call last):
File "main.py", line 27, in <module>
notes = notestore.findNotesMetadata(dev_token, filter, 0, 100, spec)
File "build/bdist.macosx-10.13-x86_64/egg/evernote/api/client.py", line 145, in delegate_method
File "build/bdist.macosx-10.13-x86_64/egg/evernote/edam/notestore/NoteStore.py", line 3981, in findNotesMetadata
File "build/bdist.macosx-10.13-x86_64/egg/evernote/edam/notestore/NoteStore.py", line 3992, in send_findNotesMetadata
File "build/bdist.macosx-10.13-x86_64/egg/evernote/edam/notestore/NoteStore.py", line 12996, in write
AttributeError: 'function' object has no attribute 'write'

Related

How can I query the bittensor network using btcli?

btcli query
Enter wallet name (default): my-wallet-name
Enter hotkey name (default): my-hotkey
Enter uids to query (All): 18
Note that my-wallet-name, my-hotkey where actually correct names. My wallet with one of my hotkeys. And I decided to query the UID 18.
But btcli is returning an error with no specific message
AttributeError: 'Dendrite' object has no attribute 'forward_text'
Exception ignored in: <function Dendrite.__del__ at 0x7f5655e3adc0>
Traceback (most recent call last):
File "/home/eduardo/repos/bittensor/venv/lib/python3.8/site-packages/bittensor/_dendrite/dendrite_impl.py", line 107, in __del__
bittensor.logging.success('Dendrite Deleted', sufix = '')
File "/home/eduardo/repos/bittensor/venv/lib/python3.8/site-packages/bittensor/_logging/__init__.py", line 341, in success
cls()
File "/home/eduardo/repos/bittensor/venv/lib/python3.8/site-packages/bittensor/_logging/__init__.py", line 73, in __new__
config = logging.config()
File "/home/eduardo/repos/bittensor/venv/lib/python3.8/site-packages/bittensor/_logging/__init__.py", line 127, in config
parser = argparse.ArgumentParser()
File "/usr/lib/python3.8/argparse.py", line 1672, in __init__
prog = _os.path.basename(_sys.argv[0])
TypeError: 'NoneType' object is not subscriptable
What does this means?
How can I query an UID correctly?
I have try to look for UIDs to query but the tool does not give me any.
I was expecting a semantic error or a way to look for a UID i can query but not a TypeError.
It appears that command is broken and should be removed.
I opened an issue for you here: https://github.com/opentensor/bittensor/issues/1085
You can use the python API like:
import bittensor
UID: int = 18
subtensor = bittensor.subtensor( network="nakamoto" )
forward_text = "testing out querying the network"
wallet = bittensor.wallet( name = "my-wallet-name", hotkey = "my-hotkey" )
dend = bittensor.dendrite( wallet = wallet )
neuron = subtensor.neuron_for_uid( UID )
endpoint = bittensor.endpoint.from_neuron( neuron )
response_codes, times, query_responses = dend.generate(endpoint, forward_text, num_to_generate=64)
response_code_text = response_codes[0]
query_response = query_responses[0]

how to export WBlock by using pyautocad

hi all i have this problem when i try to export object through WBlock what is wrong there i'm try to do simple python work (note: i'm beginners :D) .. any help
from pyautocad import Autocad, APoint,utils
import win32com.client
AutoCAD = win32com.client.dynamic.Dispatch("AutoCAD.Application")
acad = Autocad(create_if_not_exists = False)
acad.Visible=True
doc = AutoCAD.ActiveDocument
layersList = doc.Layers
for l in layersList:
object = acad.iter_objects()
if l.name == "0":
pass
else:
for o in object:
if o.ObjectName == "AcDbText":
SelectionSet = doc.SelectionSets.Item(o.ObjectName).Name
directoryN = "C:\\Temp\\{}_{}.dwg".format(l.name,o.TextString)
doc.WBlock(directoryN,SelectionSet)
here what i Get
AcDbText
Traceback (most recent call last):
File "C:/Temp/Exporter.py", line 23, in <module>
doc.WBlock(directoryN,SelectionSet)
File "<COMObject <unknown>>", line 2, in WBlock
pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 2)
thanks
i'm try to export every text as WBlock

How to fix a AttributeError in Python?

I don't success to fix this error on my code. Python wrote me this error message:
"Traceback (most recent call last):
File "C:\Users\ChloƩ CHAUMETON\Documents\BioAxial\1_R&D\4_Software\2_Python\Measurement_script\Matlab_to_Python\2019\Chloe_script_V3.py", line 114, in <module>
if 0 < len((lrir)(lrir.name_file)):
AttributeError: 'function' object has no attribute 'name_file' "
I defined the "name_file = 'BSR_Main.exe2018_09_14.csv' " up of my code but I don't understand why python don't attribute this name fto the function. Here is my code.
i_r=[]
def lrir():
lrir = liste_record[i_r]
name_file = 'BSR_Main.exe2018_09_14.csv';
for i_r in range(0,rec-1):
if 0 < len((lrir)(lrir.name_file)):
str1 = ligne.find(lrir.name_file,'/')
pr_rep = os.path.join(dir_PR,s(i_r).name_file)
log_rep = os.path.join(pr_rep,'Log')
log_file = glob.glob(os.path.join(log_rep,'*.log'))
print('log file:',log_file)

Is there a bug in this python module or am I using it the wrong way?

lambda from getattr getting called with "connection" as a keyword argument? Am I misusing the code or is there a bug?
Code and traceback: https://github.com/bigcommerce/bigcommerce-api-python/issues/32
#!/usr/bin/env python2
import bigcommerce
import bigcommerce.api
BIG_URL = 'store-45eg5.mybigcommerce.com'
BIG_USER = 'henry'
BIG_KEY = '10f0f4f371f7953c4d7d7809b62463281f15c829'
api = bigcommerce.api.BigcommerceApi(host=BIG_URL, basic_auth=(BIG_USER, BIG_KEY))
def get_category_id(name):
get_request = api.Categories.get(name)
try:
cat_list = api.Categories.all(name=name)
if cat_list:
return cat_list[0]['id']
else:
return None
except:
return None
def create_category(name):
rp = api.Categories.create(name)
if rp.status == 201:
return rp.json()['id']
else:
return get_category_id(name)
create_category('anothertestingcat')
Gives this traceback:
Traceback (most recent call last):
File "./bigcommerceimporter.py", line 50, in
create_category('anothertestingcat')
File "./bigcommerceimporter.py", line 44, in create_category
rp = api.Categories.create(name)
File "/home/henry/big_test_zone/local/lib/python2.7/site-packages/bigcommerce/api.py", line 57, in
return lambda args, *kwargs: (getattr(self.resource_class, item))(args, connection=self.connection, *kwargs)
TypeError: create() got multiple values for keyword argument 'connection'
Line in api.py that the traceback refers to: https://github.com/bigcommerce/bigcommerce-api-python/blob/master/bigcommerce/api.py#L57
According to the examples, create should be used like this:
api.Categories.create(name = 'anothertestingcat')
Note: You should generate a new API KEY, since you published the current one in this question.

Python: TypeError: 'str' object is not callable Rating System

When I run this code:
def printPredictions(matches):
pPredictionTable = PrettyTable()
pPredictionTable.field_names = ["Player 1", "Player 2", "Difference", "Winner"]
for match in matches:
p1 = match['teamA']
p2 = match['teamB']
if match['aBeatb'] == True:
pPredictionTable.add_row([match['teamA'], match['teamB'], match['difference'], p1])
else:
pPredictionTable.add_row([match['teamA'], match['teamB'], match['difference'], p2])
print(pPredictionTable)
printPredictions(pmatches)
I get this error:
Traceback (most recent call last):
File "C:\Users\ericr_000\Desktop\PyDev\NPA-2-Rating-System\Rankings.py", line 645, in <module>
printPredictions()
TypeError: 'str' object is not callable
I have pmatches as a separate dictionary, and I don't have the coding skills to fix this issue. (Line 145 is printPredictions(pmatches)
If you're getting 'str' object is not callable when you try to call printPredictions, that means that by the time your program reaches line 645, the name printPredictions was reassigned to a string. Somewhere in your code you have something like
printPredictions = someStringValueGoesHere
You should choose a different name for that variable, or delete the line entirely.
foobar = someStringValueGoesHere

Categories

Resources