Windows 10 notifications in python - python

I've tried a lot of methods found online to create notification bubbles through python, but none of them work. I suspect this has something to do with windows just not allowing them for the script, but how can I solve this?
For example, using the balloontip snippet, and in my own script:
import balloontip
Following with either of these just doesn't show any toast.
w=balloontip.WindowsBalloonTip('asdf', 'qwerty')
balloontip.balloon_tip('asdf', 'qwerty')
I've also tried using the win10toast package but still no such luck.
What's even weirder is that solutions entirely unrelated to python also don't work. For example this powershell script creates an icon in my tray but the message won't show.

Try to import all the modules used in the snippet, and include the snippet in your script. You might need to install win32api using pip install pypiwin32
This might help you identify the problem/check if it is indeed a problem with Windows notifications in general.
I was able to create a notification by adding the following code to the end:
balloon_tip("test title", "test message")
Check if you have blocked windows notifications:
http://www.howto-connect.com/disable-enable-app-notifications-on-windows-10/

Related

I am new to VSCode, Python, and the OpenAI API, and I am unable to figure out how to access the hover documentation

Every video I watch shows documentation when the user hovers over code, yet mine is nearly empty.
Example:
response = openai.Completion.create(engine="text-davinci-001", prompt=prompt, max_tokens=6)
If I hover over "create" it shows "create: Any" inside the pop-up window.
This is much less descriptive than what I see in tutorials.
How do I access documentation on a given object from within VSCode?
I have tried installing/reinstalling Python, IntelliCode and Docs View from inside VSCode.
IntelliCode does add links to GitHub but still no the standard documentation like I was expecting.
What you want is called Intellisense which is provided by extension Python and Pylance.
So the first step is to ensure that you have installed these two extensions.
Because the Intellisense is obtained from the description file in the package, and your code does not have the statement to import the package, I guess you did not install the package or import it. You have to use command pip install openai in the terminal and use the correct codes to get it:
import openai
response = openai.Completion.create(engine="text-davinci-001", prompt=prompt, max_tokens=6)

Keeps saying that Python is not found and that I need to install it on Microsoft even though I got the extensions?

I am very much a new person to coding and I was primarily trying to do something for some browser game I play. This message is what I am most concerned of: "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases." I've looked at countless videos and articles but cannot find anything that is of use for me. I don't know if this has been an issue for anyone else or has been asked of and I use Python. Could someone please help me? I also use Windows 10 with the newest version possible (3.10.6).
https://i.stack.imgur.com/Soiiw.png
Can you please reinstall the python
when installing make sure to check add python 3.10.6(your version) as Path
and in your code you hace to use this code to import emoji library also
pip install emoji
hope it helps:)
For me, turning off Python under "Apps > App Execution Aliases" in Windows 11 settings fixed it.
Fix Python for Stable Diffusion on Windows 11

Running python script with tkinter on iphone

not sure if possible, maybe someone has sucess
I have a little python script for my university exams and it will be great to show execution on the mobile. It uses tkinter for the GUI (I know, probably not the best, but it has been done like this)
I have it running on Android (not my phone) within Pydroid3 without any problem, but I can not replicate in iphone
so far i have tried Python3IDE and CodeSnackIDE (among others that can not get even python to work)
Python3IDE
as it seems terminal do not support sudo, neither apt-get, no change to install tkinter
CodeSnackIDE
successfully installed tkinter, using the instructions as:
https://docs.codesnack-ide.com/Python-using-Pipenv-5a77effdbad44930b7927a37e25d4c45
(after pipenv run sudo apt-get install python3-tk)
but i would say that the running is remote, and do not have display, can it be?
trying using tkinter raise the error:
couldn't connect to display :1
and after running export DISPLAY=unix$DISPLAY
(as local machine _tkinter.TclError: couldn't connect to display ":0")
couldn't connect to display unix:1
Am I trying something never done before?
or something not meant to be done ... :_(
I know there is posts like:
Is it possible to use Tkinter to create an app for Android or iOS?
and not sure if this fully applies

Cannot find module "qfi" for running JdeRobot drone_cat_mouse exercise from source

I want to run JdeRobot drone_cat_mouse on my Ubuntu 20.04. I'm using ROS Noetic and has faithfully followed these installation instructions. Everything it told me to test was working properly.
When I first ran roslaunch drone_cat_mouse.launch, there was an import error for teleopWidget and sensorsWidget which I fixed by using relative imports. Then I had an error No module named qfi.
Unlike teleopWidget and sensorsWidget, I couldn't find the qfi module in the JdeRobot/drones source code. So I googled it, and the only relevant result that popped up was this, which led to this link. They said to:
sudo touch /usr/lib/python2.7/dist-packages/qfi/__init__.py
But I ran that command and this happened!
Not even pip has a "qfi" module!
So I thought to check JdeRobot's entire repository. Turns out it was in JdeRobot/base, and that repo is not maintained anymore!
After further digging, there was this issue which basically tells us forget about it and move to the web release! But I can't, circumstances forced me to use the source code option (deliverables are drone_cat_mouse.world and my_solution.py, it's impossible for me to get the former in the docker web version and the latter's format is different between the source code version and the web version).
In a nutshell, how do I fix this qfi module problem so that I can run the exercises from source like these people?
I'm just stupid, as usual. all I need to do was clone https://github.com/JdeRobot/ThirdParty, get the qfi module, copy it to
~/catkin_ws/src/drones/rqt_drone_teleop/src/rqt_vel_teleop/ and replace all qfi imports with its relative import version. All common sense
No errors in terminal, gazebo runs, but somehow the rqt widget for drone vision never appears.
Forget it, I'm giving up on this dumpster fire of a program.
Edit: I did another fresh install, followed the steps, noticed troubleshooting for qfi which required qmake, but same end result
If you're trying to launch drone_cat_mouse there is an issue with the namespace of the RQT widget that occurs when you try to launch it.
Namely, the topics that exist for drone_cat_mouse are prefixed by cat/ or mouse/. But RQT will try to access these topics without the prefix and run into an error. Alternatively, since you have a local install, you can try to run the code manually by running
python my_solution.py
Just make sure the change the area where the DroneWrapper class was called in the following manner:
HAL = DroneWrapper('drone', 'cat/')
Here 'drone' is the name of the node you are creating and 'cat/' is the namespace given to the DroneWrapper Class.

Importing requests module in python using netbeans

I'm using netbeans to write a simple python program which I need the requests module for, I've downloaded requests through terminal and it all seems to be fine there but netbeans can't seem to find it.
This is the error that it's throwing up:
import requests
ImportError: No module named requests
I've tried installing the requests library directly into the python folder but the folder won't let me paste anything into it.
There do seem to be answers on the netbeans forums but their server is down so won't let me on their website to my annoyance!
EDIT
I've tried to run python setup.py install as per other answers on the website but had no luck.
EDIT
have tried completely uninstalling python and requests to make sure it wasn't an installation error but still no luck.
This clearly looks like an error of installation of the request module to some other place than where your netbeans expects when running the code.
In your console run
which python
Check if this gives the same path as the one set in your netbeans. You can set your path by adding new platform using Tools > Python Platforms > New:
I would suggest that you learn bit more about sandboxed environments such as virtualenv. This article shows how you can use a virtualenv to install packages and use the same virtualenv for netbeans so that whatever packages you install in the virtualenv will be available in the netbeans for you to use. For this case, it could be requests.
In the end I gave up with requests, as I was using requests to get json data from an API I decided just to go back to the drawing board and start over rather than attempt to fix something that I couldn't work out. I am now using the urllib import and whilst this may not be the most efficient way it works which is the most important thing.

Categories

Resources