pywhatkit.sendwhatmsg_to_group function is not working - python-3.x

It might sound crazy but yesterday the function pywhatkit.sendwhatmsg_to_group worked fine with me but today I do not seem to make it work. The message was sent using the group id.
pywhatkit.sendwhatmsg_to_group('Groupid','Testing message',11,51)
But it just worked once. Now the window opens and the particular group also gets selected but the message doesn't get typed not sent.
Has this function worked for anyone?
I am using it on windows machine and python3.

I am using:
OS: macOs Big Sur 11.4
Browser:O Google Chrome 91.0.4472.114
IDE: PyCharm CE 2021.1.3
Pywhatkit: 5.0
I changed a line of code of the sendwhatmsg_to_group function to work in my environment.
I replaced the code (line 166):
pg.click(width / 2, height - height / 10)
with this:
pg.click(width / 2, height / 2)
And then it worked.
PS: The previous code was opening an application from my program bar.

Try this. It worked for me on Python 3.9.12 jupyter notebook
pwt.sendwhatmsg_to_group_instantly('Groupid','Testing message')

Related

Why does my Selenium VBA code no longer work?

I have a very simple VGA macro in Excel that worked fine for awhile and now has stopped. I now get one of the two error message below:
The code is somewhat longer, but I've taken out the irrelevant lines; even what I have below doesn't work:
Public edgebot As WebDriver
Sub EUPatentClass()
edgebot.Start "edge"
End Sub
The references are as follows:
Current version of Edge is Version 108.0.1462.54 (Official build) (64-bit)
Current version of edgedriver.exe (renamed from msedgedriver.ext) is also Version 108.0.1462.54
I've tried uninstalling and then reinstalling Selenium 2.0.9, and also repairing .NET Core Runtime 3.1.32(x64) and .NET SDK 6.0.307(x64). I'm running Windows 10, ver 22H2 (Build 19045.2364), fully patched and up to date.
Can anyone give me a suggestion as to what to try next? THANKS!!!

Python 3.7: Pygsheets get all record stopped working

I have several scripts using pygsheets to get information from google sheets. Today they have stopped working without any errors or exceptions being noted.
Debuging Attempts:
Tried running in different ways
1. Visual Studio Code - just stops working no errors or exceptions. Debugged to line (wks = sh.worksheet('title', tabs))
2. command prompt - pops a window up that states "Python has stopped working: A problem caused the program to stop working correctly. Please close the program"
3. manually in IDLE - locks up at (wks = sh.worksheet('title', tabs))
4. Ran code on a different machine: worked fine.
So, I know it has to do with something on my machine, but not sure where to start looking. Any suggestions are welcome.
import pygsheets
from pygsheets import Worksheet
gsheet = pygsheets.authorize(service_file = 'client_secret2.json')
sh = gsheet.open('Google_file_name')
wks = sh.worksheet('title', 'tab_name')
results = wks.get_all_records()
The last line is where everything stops. Again, no errors or exceptions.
I know this doesn't really solve the issue, nor do I have experience with pygsheets, but from my experience with gspread the issue appears to be connection-related. I have had this exact issue with gspread's get_all_values module and, as you experienced, it suddenly stops working without any changes to the code and without terminating or returning any errors. The issue often disappears when the program is run again minutes or days later.
The only other time I have experienced freezing/hanging (recently in Python) is with TCP connections...

Excel export works locally, fields become hidden when running on server

OK, so i have a SmartGWT web application, where i have some reports running in list grids.
I export to excel using the Smartgwt built-in export as per the examples using the listgrid.exportclientdata();
Here's the issue:
-When running locally, all works fine and i can open the XLSX file and see all data.
-When running from the server, the columns containing data become hidden! If i manually do the "unhide" thing from within Excel, i can see the columns...
My local environment is Mac OSX, Mountain Lion(also tried earlier), running Sun's Java.
The prod server is Debian running OpenJDK.
Not sure if that would have something to do with it, and i am at a loss as to how i go about solving it... Running my webapp on Tomcat6 in both environments.
For others, searching the stackoverflow void for answers to riddles in the dark:
This was caused by certain fonts not being available in OpenJDK, without any errors being logged anywhere...
I switched to Sun's JDK on my Debian as well, and the Excel files now open and display properly.
This an also happen when facing this POI Bug that seems to be related to a Java Bug.
If it's the case changing the Font to something other than Calibri or using jre above 7u21 should fix the issue.
You can also mitigitate the issue and avoid the columns from being totally collapsed by using a code like this
sheet.autoSizeColumn(x);
if (sheet.getColumnWidth(x) == 0) {
// autosize failed use MIN_WIDTH
sheet.setColumnWidth(x, MIN_WIDTH);
}

wx.TextDropTarget not working in Linux

I have a desktop application developed with wxPython. The applications runs fine under Windows and OSX (same codebase, no platform specific code). Everything works on Linux except drag and drop. I can drag just fine, but DoDragDrop always returns wx.DragCancel. I can however, drag from my application or to another app/desktop which excepts text and DoDragDrop returns wx.DragCopy.
It seems to me like the DropTargets aren't getting called. I've added debug statements to OnData, etc and they are never activated.
Has anyone seen this and know of a workaround?
Found a known issue in wxWidgets that was considered fixed, http://trac.wxwidgets.org/ticket/2763, I am able to recreate this issue on linux. I reopened the ticket.
In the meantime you can swap your StaticBoxSizers or BoxSizers. or...
This works....
parent = DropTargetCtrn.GetParent()
boxes = [x for x in parent.GetChildren() if type(x)==wx.StaticBox]
tmpParent = wx.Panel(parent)
for box in boxes:
box.Reparent(tmpParent)
box.Reparent(parent)
parent.Destroy()
This solution seems to lower the StaticBox in the window hierarchy so it don't interfere with drop events. Note, box.Lower() does not work.

Strange error returned from mciSendString - Can anyone help?

A few months ago I added audio recording to a MFC app that I'm working on. This turned out to be easy enough and after an hour or two the code was working on my PC and on a couple of the customers test machines (one running XP the other Vista). Recently however one of their test machines was upgraded and now the recording feature refuses to work.
The basic code to start the recording is ..
mcierr=mciSendString("open new type waveaudio alias mysound",tmpstr,80,NULL);
mcierr=mciSendString("set mysound time format ms bitspersample 8 samplespersec 11025",tmpstr,80,NULL);
mcierr=mciSendString("record mysound",tmpstr,80,NULL);
which appears to work fine. To stop recording the following code is executed ..
mcierr=mciSendString("stop mysound",tmpstr,80,NULL);
mcierr=mciSendString("save mysound C:\\filename.wav",tmpstr,80,NULL);
mcierr=mciSendString("close mysound",tmpstr,80,NULL);
The following error occurs when the "save mysound C:\filename.wav" instruction is sent. The error returned is ..
MCI Error A parameter or value was specified twice. Only specify it once.
But I can't see any error in what I am sending and that error doesn't make sense. Is it possible that the error is because the program is trying to record using a format the PC doesn't support ?
Thanks for your time
Ian
OK I managed to find a solution to this. This line in the code ..
mcierr=mciSendString("save mysound C:\\filename.wav",tmpstr,80,NULL);
works fine on my development PC running XP but causes errors on some test PC's running XP and on all of them running Vista. The error goes away however if the filename itself is put within quotes like this ..
mcierr=mciSendString("save mysound "C:\\filename.wav"",tmpstr,80,NULL);
Now the code runs fine on all the XP and Vista PC's it has been tested on.
Ian
A detail more is necessary to have it working.
Please watch the double "" before and after the file name:
mcierr=mciSendString("save mysound ""C:\\filename.wav""",tmpstr,80,NULL);
This is fine, too:
mcierr=mciSendString(#"save mysound ""C:\filename.wav""",tmpstr,80,NULL);
With these double quotation marks the code works on my Windows 7 now.

Resources