for i in range(0, len(messages)):
review= re.sub('[^a-zA-Z]',' ',messages['message'][i])
review=review.lower()
review=review.split()
review=[ps.stem(word) for word in review if not word in stopwords.words('english')]
review=' '.join(review)
corpus.append(review)
above is my code and receiving type error 'cannot use a string pattern on a bytes-like object'
for 2nd line. how to resolve it?
Related
trying to open folder using R by the code
system2("open","/Users/folder (P)")
results in error A below
sh: -c: line 0: syntax error near unexpected token `('
i think it is because the folder name has parentheses. looking forward to help and any comments are welcome
I tried the below code too--
system2("open","/Users/folder \(P\)")
then error B is
Error: '\(' is an unrecognized escape in character string
I also tried hitting Tab button, then successfully selecting the "folder (P)", but it results in the same error A
Iam using below xpath:
//label[text()='First Name']/Parent::div/following-sibling::div/div/input[#disabled='disabled']
But showing an error as:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string
'//label[text()='First
Name']/Parent::div/following-sibling::div/div/input[#disabled='disabled']'
is not a valid XPath expression.
The error says it all - the expression is invalid. The issue is in the parent axis - it has to be in small caps, not capitalized as you've set it.
Maybe you can try to make a shorter Xpath, because seems long Xpath are hard to read, so as an example you can try with:
//button[contains(text(),'Yes')]
or
//button[contains(.,'Yes')]
Make a shorter Xpath worked for me.
I am trying to reference a location in my Firebase database, but .child() fails with the following error:
Uncaught Error: Firebase.child failed: First argument was an invalid path: "https://wooperate.firebaseio.com/comments-to/-KTLOwq-WK4VwMhG7Zz8/-KTPmJJtmZQa7ldWILks". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
Not only is it a valid path, but it also contains data!
Am I thick or is this just a bug in Firebase?
Edit: This is the code that triggers the error:
FIREBASE_REF.child('comments-to').child(post.id).child(comment.id);
Explanation of variables:
FIREBASE_REF: root referance to my firebase database
post.id: Firebase generated id
comment.id: Firebase generated id Full Firebase reference to the comment ― This was the error :(
The following does not trigger any errors:
FIREBASE_REF.child('comments-to').child(post.id);
As stated above, the path to the comment exists and contains data.
Maybe your comment.id is empty or contains ".", "#", "$", "[", or "]" as said in logcat. Sometimes using - and nodes starting with Capital Letter also cause this problem. It could be with comments-to try using commentsTo instead.
Yes, I'm thick.
I misunderstood the error message. Of course the illegal argument was the argument provided to child(): i.e. comment.id, and not the (url to) the reference resulting from the call .child(comment.id).
The source of the error was that I used snap.ref rather than snap.val when I set the comment.id.
Im getting this error in my firebase realtime database when trying to publish the new rules.The error is as it says in the title "missing ) after argument list" not really sure what the issue is but here is the line that gave me the error
,".validate": "newData.val().contains('data.parent().child('Name').val()')"
The single quotes in the value are likely to be the problem:
"newData.val().contains('data.parent().child('Name').val()')"
^ these quotes ^
I'm trying to use http://ci-merchant.org/ for CodeIgniter. But when I load the merchant library, I get these errors:
A PHP Error was encountered
Severity: Warning
Message: stripos() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 97
A PHP Error was encountered
Severity: Warning
Message: strtolower() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 103
Here is my code:
$this->load->library('merchant');
$this->merchant->load('paypal_express');
Looking at the source of that file, the driver name needs to be passed as a string. So I highly doubt the two lines of code you put above is actually what's being called, it looks like you are passing an array as the driver name.
If you aren't sure where it's coming from, try adding some debug_print_backtrace() lines to the merchant.php file to figure out where the array is getting passed from.