Bug when try to use gtts - - python

I met this problem when running program, this also happened when I tried pyttsx3 . Anyone know this problem. I was looking for some solution but none of it works.
Traceback (most recent call last):
File "/Users/macbookpro/Documents/python/generate_words.py", line 80, in <module>
main()
File "/Users/macbookpro/Documents/python/generate_words.py", line 16, in main
answer_part()
File "/Users/macbookpro/Documents/python/generate_words.py", line 51, in answer_part
translate(w)
File "/Users/macbookpro/Documents/python/generate_words.py", line 57, in translate
playsound.playsound('welcome.mp3')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/playsound.py", line 55, in _playsoundOSX
from AppKit import NSSound
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/AppKit/__init__.py", line 10, in <module>
import Foundation
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Foundation/__init__.py", line 9, in <module>
import CoreFoundation
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/CoreFoundation/__init__.py", line 9, in <module>
import objc
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/objc/__init__.py", line 6, in <module>
from . import _objc
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/objc/_objc.cpython-310-darwin.so, 2): Symbol not found: _FSPathMakeRef
Referenced from: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/objc/_objc.cpython-310-darwin.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/objc/_objc.cpython-310-darwin.so

Related

Python bamboolib has no attribute plugins

I'm trying to install bamboolib on a virtual env (py 3.6.8) but when I try to import the library on Jupyter lab I get the following error: module 'bamboolib' has no attribute 'plugins'.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\__init__.py", line 85, in <module>
from bamboolib.wrangler import show
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\wrangler.py", line 81, in <module>
from bamboolib.views.suggest_string_manipulation import SuggestStringManipulation
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\views\suggest_string_manipulation.py", line 13, in <module>
from bamboolib.transformation_plugins.string_transformations import (
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\transformation_plugins\__init__.py", line 5, in <module>
from bamboolib.transformation_plugins.bulk_change_datatype import BulkChangeDatatype
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\transformation_plugins\bulk_change_datatype.py", line 9, in <module>
from bamboolib.plugins import TransformationPlugin, DF_OLD, DF_NEW, Singleselect, Text
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\plugins\__init__.py", line 6, in <module>
from bamboolib.plugins._utils import create_plugin_base_class
File "C:\Users\f.surace\py36\lib\site-packages\bamboolib\plugins\_utils.py", line 5, in <module>
import bamboolib.plugins._registry as PluginRegistry
AttributeError: module 'bamboolib' has no attribute 'plugins'

Thonny py5-mode Error when running a code

I just tried to use py5 in thonny, but everytime i have the py5 mode on and try to run a code i get a bunch of error messeges, i dont really know what they mean so maybe somebody can help me out ?
thanks in advance
This is the error im always getting
Traceback (most recent call last):
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\tools\run_sketch.py", line 52, in <module>
main()
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\tools\run_sketch.py", line 44, in main
imported.run_code(
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\imported.py", line 135, in run_code
_run_code(
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\imported.py", line 259, in _run_code
_run_sketch(sketch_path, classpath, exit_if_error)
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\imported.py", line 196, in _run_sketch
import py5
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5\__init__.py", line 84, in <module>
from py5_tools.magics import load_ipython_extension # noqa
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\magics\__init__.py", line 22, in <module>
from .drawing import DrawingMagics, DXFDrawingMagic
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\py5_tools\magics\drawing.py", line 27, in <module>
from IPython.display import display, SVG, Image
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\__init__.py", line 51, in <module>
from .core.application import Application
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\core\application.py", line 26, in <module>
from IPython.core import release, crashhandler
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\core\crashhandler.py", line 27, in <module>
from IPython.core import ultratb
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\IPython\core\ultratb.py", line 101, in <module>
import stack_data
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\stack_data\__init__.py", line 1, in <module>
from .core import Source, FrameInfo, markers_from_ranges, Options, LINE_GAP, Line, Variable, RangeInLine, \
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\stack_data\core.py", line 19, in <module>
from stack_data.utils import (
File "C:\Users\schwe\AppData\Roaming\Thonny\plugins\Python310\site-packages\stack_data\utils.py", line 11, in <module>
from asttokens import ASTText
ImportError: cannot import name 'ASTText' from 'asttokens' (C:\Users\schwe\AppData\Local\Programs\Thonny\lib\site-packages\asttokens\__init__.py)
I received a response from the py5 developer via Github. They also provided an explanation but it goes over my head, something about "The Python library asttokens is used for parsing syntax trees and syntax highlighting. It is not used by py5 but it might be used by Jupyter Notebook and/or JupyterLab.". They also provided a solution here:
enter link description here

Theano tensor import error

I have been trying to import theano.tensor in my code.
I have used theano.tensor before. All of my previous code importing theano.tensor works perfectly in my machine. Now I am trying to write another script importing the tensor from theano and I am getting the following exception.
Traceback (most recent call last):
File "code.py", line 2, in <module>
import theano.tensor as T
File "/anaconda3/lib/python3.5/site-packages/theano/__init__.py", line 52, in <module>
from theano.gof import (
File "/anaconda3/lib/python3.5/site-packages/theano/gof/__init__.py", line 56, in <module>
from theano.gof.opt import (
File "/anaconda3/lib/python3.5/site-packages/theano/gof/opt.py", line 11, in <module>
import pdb
File "/anaconda3/lib/python3.5/pdb.py", line 75, in <module>
import code
File "/localtmp/saikat/CovInfo/Closure/code.py", line 2, in <module>
import theano.tensor as T
File "/anaconda3/lib/python3.5/site-packages/theano/tensor/__init__.py", line 6, in <module>
from theano.tensor.basic import *
File "/anaconda3/lib/python3.5/site-packages/theano/tensor/basic.py", line 17, in <module>
from theano.tensor import elemwise
File "/anaconda3/lib/python3.5/site-packages/theano/tensor/elemwise.py", line 13, in <module>
from theano import scalar
File "/anaconda3/lib/python3.5/site-packages/theano/scalar/__init__.py", line 2, in <module>
from .basic import *
File "/anaconda3/lib/python3.5/site-packages/theano/scalar/basic.py", line 25, in <module>
from theano import gof, printing
File "/anaconda3/lib/python3.5/site-packages/theano/printing.py", line 22, in <module>
from theano.compile import Function, debugmode, SharedVariable
File "/anaconda3/lib/python3.5/site-packages/theano/compile/__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "/anaconda3/lib/python3.5/site-packages/theano/compile/function_module.py", line 22, in <module>
import theano.compile.mode
File "/anaconda3/lib/python3.5/site-packages/theano/compile/mode.py", line 77, in <module>
OPT_NONE = gof.Query(include=[], exclude=exclude)
AttributeError: module 'theano.gof' has no attribute 'Query'
I cannot find any plausible reason for this exception.
I guess i got your problem. See in the error log:
File "/anaconda3/lib/python3.5/pdb.py", line 75, in <module>
import code
I believe there is another script called code.py in Theano which gets called from pdb.py when python interpreter executes your script which is also named as code.py. I am guessing python interpreter is mixing up these two scripts and executing the wrong one! You can change the filename and check whether the error disappear or not.

Using pwntools in mac

I want to use pwntools(which is python module) in my mac. However I get error instead of pwntools. I tried all step in https://github.com/Gallopsled/pwntools/issues. But I get
Traceback (most recent call last):
File "/Users/Knight/PycharmProjects/untitled/gmail.py", line 1, in <module>
import pwn
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwn/__init__.py", line 2, in <module>
from .toplevel import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwn/toplevel.py", line 20, in <module>
import pwnlib
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/__init__.py", line 40, in <module>
importlib.import_module('.%s' % module, 'pwnlib')
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/args.py", line 10, in <module>
from . import term
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/term/__init__.py", line 3, in <module>
from . import completer
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/term/completer.py", line 4, in <module>
from . import readline
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/term/readline.py", line 4, in <module>
from . import text
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/term/text.py", line 115, in <module>
sys.modules[__name__] = Module()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/term/text.py", line 26, in __init__
self.num_colors = termcap.get('colors', default = 8)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pwnlib/term/termcap.py", line 25, in get
s = curses.tigetstr(cap)
_curses.error: must call (at least) setupterm() first
I can't understand why I can't use it.
Help me please
You must set the following environment variables as indicated here
export TERM=linux
export TERMINFO=/etc/terminfo
Setupterm could not find terminal, in Python program using curses

Weird behaviour with tweepy in Python?

I have python 2.7.9 on OS X (10.11). I have installed tweepy 3.5.0 and simplejson 3.8.1. When i write a program (IDE: textWrangler) for updating status of twitter account (by using tweepy) and run the program using command line it throws error on "import tweepy" in a program. However when i run the same code on python shell, it execute sucessfuly (without any error). Any suggestions or comments?
Traceback (most recent call last):
File "tweepytesting.py", line 1, in <module>
import tweepy
File "build/bdist.macosx-10.6-intel/egg/tweepy/__init__.py", line 14, in <module>
File "build/bdist.macosx-10.6-intel/egg/tweepy/api.py", line 12, in <module>
File "build/bdist.macosx-10.6-intel/egg/tweepy/binder.py", line 11, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/__init__.py", line 53, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 33, in <module>
from .packages.ssl_match_hostname import CertificateError
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/packages/__init__.py", line 3, in <module>
from . import ssl_match_hostname
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py", line 3, in <module>
from ssl import CertificateError, match_hostname
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 90, in <module>
import textwrap
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/textwrap.py", line 40, in <module>
class TextWrapper:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/textwrap.py", line 82, in TextWrapper
whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
AttributeError: 'module' object has no attribute 'maketrans'
If I add this line:
import string; print(string)
just above import tweepy, then the following is printed:
<module 'string' from '/Users/yasirmuhammad/Desktop/learnpython/string.pyc'>

Categories

Resources