win32wnet.WNetCancelConnection2("",0,0)
What exactly I have to pass as the first parameter here ?
network path ?? eg:- "\\192.168.7.177"
machine_name
or something else .
Thanking everybody in advance.
You were right regarding the network path. It should look something like this:
win32wnet.WNetCancelConnection2('\\\\127.0.0.1\\c$',0,0)
You can find out more here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385427(v=vs.85).aspx
Don't forget about the escape character!
Related
I have not used vscode for a while, and when i opened it last night. It won't let me change any setting because the error in the json setting. I tried to fix it but i failed.
Thank you for some people helping me to fix the first part of the code. But i still have the error for the second part. Tried to remove and add the {}, but it does not help.
you don't have valid json.
delete the code runner line or add a value to it with a comma at the end
something got borked up on your settings file
valid json is like this
{
"key": value,
}
looks like te json is not well formatted. For every array you should have key:value, but on your screenshot seems like you wrote key:key:value.
In the setting file "settings.json", we need to pay attention to: 1. Please use "," to separate the settings; 2. As people say, we need to write the settings completely. (For settings that are not used, we can comment them out.)
Before:
After:
I am trying to test a Zapier field with python code block to see if it ends with .mov. If so, I want to remove the .mov. If not, just return the field as is. The code I have works, but I have added a .lower() to make it work and don't understand why it behaves that way.
I have tried multiple variations but the only one that seems to work is adding string formatting .lower() in the variable.
formatted_str = input_data['text']
if formatted_str.endswith('.mov'):
formatted_str = formatted_str[:-4]
return {'formatted_str':formatted_str.lower()}
I would like to return the results without having to change it to all lower case. I know it is possible, but I am not having any luck. Thank you so much!
With the help of Zapier folks, I figured out my issue. Thank you!
formatted_str = input_data['text']
if formatted_str.endswith('.mov'):
formatted_str = formatted_str[:-4]
return {'text':formatted_str}
I have an the following function in Apache Airflow:
from airflow.utils.email import send_email
send_email(to=['a#mail.com','b#mail.com'],
subject=....)
This works great.
Now I don't want to hard code the email list so I save it as a configurable field that the user can change from his UI.
So I change my code to:
NOTIFY_LIST = Variable.get("a_emails")
send_email([NOTIFY_LIST],
subject=....)
But this doesn't work.
When I do:
logging.info(NOTIFY_LIST)
logging.info([NOTIFY_LIST])
logging.info(NOTIFY_LIST.split(','))
I see:
'a#mail.com', 'b#mail.com'
[u"'a#mail.com', 'b#mail.com'"]
[u"'a#mail.com'", u" 'b#mail.com'"]
So my problem is that:
['a#mail.com','b#mail.com']
and
[NOTIFY_LIST]
isn't the same.
How can I fix this? I tried any conversion I could think of.
A suggestion to try the following;
logging.info(NOTIFY_LIST.replace("'", "").split(','))
The problem here is that the elements in the list contain quote marks.
The other answer will fail if there's an ' in the midle of the strings, to fix that I'll use str.strip:
logging.info([s.strip("' ") for s in NOTIFY_LIST.split(',')])
What am I doing wrong? I am sure its just a simpile sytanx error.
Help is appreciated
db.venues.truncate("RESTARTIDENTITYCASCADE")
It looks like your command is all globed together without spaces. This link shows the command as:
db.venues.truncate('RESTART IDENTITY CASCADE')
I am using a piece of code and am trying to debug it.
But something weird is happening.
In one part, I have this line:
vals = find(A)
But it gives me this error :
global name 'find' is not defined
I thought find was like an inbuilt function in python??
Clearly I am mistaken.
But just want to check.. in case I am forgetting to include anything.
find is a string method:
'python'.find('y') # gives 1
The real answer is:
look in this page:
http://docs.python.org/genindex.html
Why thinking to search with Google and not in an official doc ? Did you think that Python hadn't documentation ?