pypiwin32 alternatives for Mac - macos

Is there an alternative for pypiwin32 on Mac?
I'm doing a tutorial on how to create a chatbot, however I keep getting an import error. I was given advice to install pypiwin32 but soon realized it only works for windows and not on osx. Below is the code for the chatbot where I get the import error on.
import speech_recognition as sr
import pyttsx3
try:
engine = pyttsx3.init()
except ImportError:
print("Requested driver is not found")
except RuntimeError:
print("Driver failed to initialize")
voices = engine.getProperty('voices')
for voice in voices:
print(voice.id)

I don't think there is an alternative to pypiwin32 for OSX, maybe you can share what your error is so we can help you that way?
Not an answer but I can't comment yet...

If you are running it on mac OSX, you need to additionally install:
pip install pyobjc
it will work. I had tried the following:
import pyttsx3
engine = pyttsx3.init('nsss')
voices = engine.getProperty('voices')
after installing pyobj and it is working now :)

Related

Why can't I install a library with a minus sign in it?

I'm new to Python and I'm trying to import a module that I installed, "python-evtx". I successfully installed it, but when I try to import it in the environment (Python 3.10.9) using Idle I get a syntax error that points at the "-" sign. As far as I can tell, import chokes on that"-" sign. Can anybody help? Thanks!
Here is a screenshot of my issue:
(https://i.stack.imgur.com/h9oxj.png)

How to import Prolog from pwsip

I tried running this code in VISIO CODE STUDIO:
from pyswip import Prolog
from tkinter import *
from tkinter import messagebox
and I got an error. what am I doing wrong? Thanks.
It looks like you don't have pySwip installed, or at least it cannot be found.
I tried
https://pypi.org/project/pyswip/
Were one reads:
WARNING! PySwip has no Windows installers! If you are a Windows user,
see INSTALL. There are some "free download" sites that claim to be
hosting PySwip installers. DO NOT TRUST THEM!
They have an INSTALL.md but clicking on that just leads to a 404.
but you can get it from github:
https://github.com/yuce/pyswip/blob/master/INSTALL.md
You are on Windows, so:
Make sure swipl executable is on the PATH.
Run pip install pyswip

import tensorflow SyntaxError: invalid syntax

Using Virtualenv on Mac I have encountered the showing SyntaxError when I
import tensorflow
I tried many times uninstall but now working... please help me!
Tensorflow is not supported on Python 3.7. You'll need to use python3.6 or earlier.
async which was fine as a variable name in earlier versions of Python, is a keyword in Python 3.7. This is why it is failing to import.

import error in wxPython: import wx.animate on windows7(64bit OS) with python3.5.1 in Anaconda 4.2.0(32bit)

I am working on Windows7(64 bit OS) with Anaconda's python 3.5.1(32bit).
I have installed wxPython for GUI.
I keep getting the below import error
ImportError: No module named 'wx.animate'
import wx is working fine.
import wx
wx.version()
gives
'3.0.3.dev2752+8304ec1 msw (phoenix)''
I have installed wxPython from
https://wxpython.org/Phoenix/snapshot-builds/
the version is,
wxPython_Phoenix-3.0.3.dev2752+8304ec1-cp35-cp35m-win32.whl
I have checked the path and don't see any problem there..
Can anyone guide me on where this is going wrong?
Thanks.
The classes formerly in wx.animate in wxPython Classic are now in wx.adv in wxPython Phoenix. See https://wxpython.org/Phoenix/docs/html/classic_vs_phoenix.html#modules-which-have-moved

Problems setting up pySDL2 on mac os x 10.9

I am having trouble setting up PySDL2 on my macbook pro running OSX 10.9. I downloaded and installed SDL 2.0.1 and I am trying to follow the PySDL2 tutorial here: http://pysdl2.readthedocs.org/en/latest/integration.html
I do not know what to do when it says "it is also possible to set the environment variable PYSDL2_DLL_PATH, which shall point to the directory of the SDL2 library." I tried running "export PYSDL2_DLL_PATH=/Library/Frameworks", but I don't know if that's what I'm supposed to do. Currently when I try to run this code:
import sys
try:
import sdl2.ext as sdl2ext
except ImportError:
import traceback
traceback.print_exc()
sys.exit(1)
from sdl2.ext import Resources
RESOURCES = Resources(__file__, "resources")
I get the error "ImportError: No module named 'sdl2'"
So how do I properly set this up?
Edit: Using macports I got things setup correctly. Thank you sirs.
Have you tried installing it via macports?
$ sudo port install py-SDL

Resources