sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type boolean: "sdzf" - python-3.x

I'm making a function in my e-commerce website which updates credentials of a user. whenever my form triggers this function I get the error -> sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type boolean: "sdzf"
I'm unable to find out what's wrong. Please help me find the issue. Thanks in advance.
python code:
#app.route("/admin_cred_update", methods=["POST","GET"])
def admin_cred_update():
email=str(request.form.get("email"))
password=str(request.form.get("password"))
if re.search("[.,*/%$#:|\[\]\(\)]",email) and re.search("[.,*/%$#:|\[\]\(\)]",password):
message="there are some invalid characters in above fields"
return render_template("admin_profile.html", updatemes=message)
else:
db.execute("update admin_master_tbl SET email=:email and password=:password where email=:smail and password=:spassword",{"email":email,"password":password,"smail":session["adminname"],"spassword":session["adminpassword"]})
session["adminname"]=email
session["adminpassword"]=password
message1="credentials updated succesfully"
return render_template("admin_profile.html", updatemes=message1)
error log:
sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type boolean: "sdzf"
LINE 1: update admin_master_tbl SET email='sdzf' and password='csadf...
^
[SQL: update admin_master_tbl SET email=%(email)s and password=%(password)s where email=%(smail)s and password=%(spassword)s]
[parameters: {'email': 'sdzf', 'password': 'csadfc', 'smail': 'lightningdrago72#gmail.com', 'spassword': 'asdf'}]

Oh I found the problem!!. I did the mistake of putting and instead of , in the SET part of my query. Now the problem is solved!!.

Related

Binance API in python APIError(code=-1121): Invalid symbol

I am trying to code a binance Buy function. However the code
from binance.enums import *
order = client.create_order(symbol='DOGEUSDT', side = 'BUY', type = 'MARKET', quantity = 475, timeInForce='GTC')
this code outputs > APIError(code=-1121): Invalid symbol.
Also, for the same symbol,
print(client.get_symbol_info(symbol="DOGEUSDT"))
ouptuts > None
The symbol DOGEUSDT exists is the orderbook. https://api.binance.com/api/v3/ticker/bookTicker
I dont know why the same symbol I get from binance is invalid.
Are you using the testnet? I had the same error, however when I removed testnet=True from the client initialization the error was resolved.
two things can happen
client.API_URL = https://testnet.binance.vision/api
in that case change it to
https://api.binance.com/api
Client(api_key, secret_key, testnet=True)
in that case change testnet=False or delete it

Nim: Can't access fields of object returned by a procedure

I was trying to write a lexer in Nim. Sorry, if this sounds a bit idiotic because I started using nim yesterday, so my problem is that I created a type such as what follows
import position
type
Error* = object
pos_start : position.Position
pos_end : position.Position
name: string
details: string
then I went on to create a procedure that returns an instance of this type,
proc IllegalCharacterError*(pos_start : position.Position, pos_end : position.Position, details : string) : Error =
return Error(pos_start: pos_start, pos_end: pos_end, name: "IllegalCharacterError", details: details)
Now, everything works fine except when I, from another module, try to access fields of this returned instance I get error
from errors import nil
from position import nil
var current_char = "2"
let pos = position.Position(idx: -1, ln: 0, col: -1, fn: fn, ftxt: text)
let error = errors.IllegalCharacterError(pos, pos, current_char)
echo error.name
The last line is the one that throws the error and following is the error that appeared during compilation
Error: undeclared field: 'name' for type errors.Error [declared in C:\Users\Mlogix\Desktop\testNim\errors.nim(4, 3)]
Thanks, any help would be really appreciated.
Ok, finally after an hour I realized that my fields weren't public. For anyone from the future, I changed my type code to
import position
type
Error* = object
pos_start* : position.Position
pos_end* : position.Position
name*: string
details*: string
and it worked. Hooray.

Problem with billing_agreement.cancel(). ('cancel() missing 1 required positional argument: 'attributes')

SDK/Library version: 1.13.1
Environment: Sandbox
PayPal-Debug-ID values: None
Language, the language version, and OS: Python, Ubuntu
Issue description:
I'm getting the following error when I try to cancel a billing agreement.
The error:
TypeError: cancel() missing 1 required positional argument: 'attributes'
My code:
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel():
print(billing_agreement)
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
I'm getting the error because I need something in the attribute's value but I don't know what should I assign to the variable.
GitHub issue: https://github.com/paypal/PayPal-Python-SDK/issues/297
After some digging and looking at the documentation samples I found a sample about the cancel option and what I needed to assign to the attribute value was a cancel_note.
The code:
cancel_note = {"note": "Canceling the agreement"}
user = Users.query.filter_by(id=ID).first()
billing_id = Subscriptions.query.filter_by(email=user.email).filter_by(active=1).first().order_id
billing_agreement = BillingAgreement.find(billing_id)
if billing_agreement.cancel(cancel_note):
flash('Subscription canceled with success.', 'success')
return redirect(url_for('settings.settingspage'))
else:
flash('We are having some difficulties canceling your subscription, please try again later.', 'fails')
return redirect(url_for('settings.settingspage'))
The documentation sample

Invalid Syntax for PEP-8

I'm receiving a notification that advised the below script is not PEP-8:
example_var = print('whoa')
Output:
[E] invalid syntax.
It's showing that the error is a result of the first parentheses in the print statement, but nothing looks off to me.
example_var = print('whoa')
example_var

how to check if a colmmande return is true or false selenium-ide

I'm trying to get a command return with selenium ide by doing it :
storeTextPresent|myText|title
gotoIf|storedVars.tite|true
echo|${"true"}
but it doesnt work...i have : [error] Unexpected Exception: fileName -> chrome://flowcontrol/content/extensions/goto-sel-ide.js?1347871647495, lineNumber -> 120.
Does anybody know how to get the return?
Thank you
I didn't check for boolean support on gotoIf, but if gotoIf wants to go to a label, I don't see a label defined in the above script.
Also, the "storedVars.tite" reference looks to be misspelled.

Resources