"TypeError: expected bytes, str found" when calling .MidiIn() from rtmidi-python - python-3.4

I installed rtmidi_python for Python 3.4.2 from the .whl provided on http://www.lfd.uci.edu/~gohlke/pythonlibs/, and the import works fine, but as soon as I call "rtmidi_python.MidiIn()", I get a TypeError as follows:
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import rtmidi_python
>>> rtmidi_python.MidiIn()
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
rtmidi_python.MidiIn()
File "rtmidi_python.pyx", line 72, in rtmidi_python.MidiIn.__cinit__ (rtmidi_python.cpp:1440)
TypeError: expected bytes, str found
As I understand, after some research, this means that the there's a mistake somewhere in the package itself or in the build of it, and there's nothing I can do about it, but I might be wrong. Can anyone confirm?
I use 3.4.2 because that is the version of Python used by the current version of Blender. I want to use rtmidi-python within the Blender Game Engine.
I am currently working on Windows 7 32 bit, and use .whls to install packages as I do not have the necessary C++ compiler for regular pip installs.
For comparison, I previously installed rtmidi-python for 3.5.1, also from the adequate .whl provided on the link above, and there the command worked perfectly fine.
Should any necessary information be missing, feel free to ask. Thanks ahead if the answer comes as a comment and I don't get to upvote it.

While not a perfect solution, this can be fixed in the manner described by sehqlr here...https://github.com/superquadratic/rtmidi-python/issues/17
...by calling MidiIn() like this:
>>> rtmidi_python.MidiIn(b'in')

Related

Mypy raises syntax error with pydrake stub

When I try to run mypy in my project that has PyDrake as a depencency I get: venv/lib/python3.9/site-packages/pydrake/common/eigen_geometry.pyi:30: error: invalid syntax
The line in questions is: def cast[AutoDiffXd](self, *args, **kwargs) -> Any: .... I'm assuming this has something to do with PyDrake's custom templating system. How can I make MyPy and PyDrake play nice?
Environment Info
OS: Ubuntu 20.04
Python version: 3.9.16
MyPy version: 0.991
Drake version: 1.11.0
As of the current version of Drake (v1.12.0), we unfortunately do not support Mypy. The purpose of the *.pyi files as of today is solely to enable VSCode suggestion auto-complete.
We didn't have a central issue tracking this, so I've filed a new one. Hopefully we can remove the syntax errors down the road.
The only work-around I know of for today is to delete the *.pyi files if you use Mypy.

mypyc, KeyError: '__file__'

I successfully use mypyc in my project and it has performed well until just a couple days ago. I now get the following error:
File "mypyc/__main__.py", line 18, in <module>
KeyError: '__file__'
Line 18 above, i.e., the line that is failing, is just
base_path = os.path.join(os.path.dirname(__file__), '..')
which I wouldn't expect to fail. I am in my venv virtualenv when I execute mypyc using the same command as has always worked before.
I thought perhaps a regression was introduced in mypyc so I used git to go back in time to see if that line had changed in any recent version of mypy, but it hadn't.
I also tried downgrading mypy to an older version that worked before but that version also failed with the same error. To be sure it wasn't being experienced by others I also checked the issues at the mypy repo on github and did a search for __file__ to see if that part of the error message showed up and it didn't. Perhaps it is some weird issue with my environment?
I experience the issue with venv virtualenvs created with Python 3.10, 3.10.1 but also 3.9.9 too. It worked fine on Python 3.10 before. Any ideas on what to investigate next?

New version of OpenSSL causes Plone/Zope to not start

Today's (1 Mar 2016) OpenSSL release has caused the following error when running Plone/Zope
.buildout/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/persistent/cPersistence.so: undefined symbol: SSLv2_method
It's hard to see what's going on since it's a binary file. I also tried updating to ZODB3 3.11.0 which yields the following traceback
.buildout/eggs/ZConfig-2.9.0-py2.7.egg/ZConfig/loader.py", line 217, in schemaComponentSource
package=package)
ZConfig.SchemaResourceError: could not load package ZServer:
.buildout/eggs/zope.security-3.7.4-py2.7-linux-x86_64.egg/zope/security/_proxy.so: undefined symbol: SSLv2_method
Package name: 'ZServer'
File name: 'component.xml'
Package path: None
Is there any workaround for this other than reverting OpenSSL?
zope security is a compiled egg, like all the ones ending with -py2.7-linux-x86_64.egg.
As the traceback says, it cannot find anymore a symbol.
Probably you have to recompile it with the new openssl-dev.
I would try (on a development server first):
backup your compiled egg (mkdir eggs-backup && mv `eggs/zope.security-3.7.4-py2.7-linux-x86_64.egg eggs-backup/)
rerun buildout
This will recompile your missing egg.
Hopefully it works and hopefully it is the only one linked to that library.
Anyway, dependending on the way you patched openssl you may have a lot of other issues (I am thinking about Python, urllib*, curl, wget, ...)
OpenSSL 1.0.2g by default doesn't build with SSLv2 (because of the recent DROWN attack). You may need to manually build it without OPENSSL_NO_SSL2 flag.
(but in fact you shouldn't do this if you're doing some server-related stuff, there is a serious security reason because of which it was disabled, see https://drownattack.com)
I was able to resolve this by upgrading python to 2.7.10+, and then upgrading Pillow and lxml.

R EnvironmentError: Could not find Ghostscript on path. RWebLogo

I ran into an odd issue that I cannot fix in any way and I was hoping someone here may have a better understanding of whats wrong;
I am unable to use RWebLogo package - even run the simplest examples due to the same missing Ghostscript error.
e.g. running:
library(RWebLogo)
aln <- c('CCAACCCAA', 'CCAACCCTA', 'AAAGCCTGA', 'TGAACCGGA')
weblogo(seqs=aln, file.out='mylogo.pdf')
Throws this error:
Traceback (most recent call last):
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogo", line 71, in <module>
weblogolib._cli.main()
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/_cli.py", line 82, in main
formatter(data, format, opts.fout)
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/__init__.py", line 757, in pdf_formatter
gs = GhostscriptAPI()
File "/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogolib/__init__.py", line 196, in __init__
raise EnvironmentError("Could not find Ghostscript on path."
EnvironmentError: Could not find Ghostscript on path. There should be either a gs executable or a gswin32c.exe on your system's path
I have installed ghostscript ver 9.15 with configure/make/install in the terminal and then added the PATH to bash profile and executed it. When I run gs in the terminal it works, confirming it is set to the system path, yet the same error still occurs. Even after rebooting.
I tried adding the gs to the environment in R directly:
Sys.setenv(R_GSCMD = "/Applications/ghostscript-9.15/bin/gs")
which also hasn't helped... Gives exactly the same error. When I search the R environment it shows that gs is there.
Important version information:
MAC: OS Yosemite 10.10.1;
R version 3.1.1 (2014-07-10);
Platform: x86_64-apple-darwin10.8.0 (64-bit);
RWebLogo_1.0.3
Do you know of any issue that may have cause this problem? I'm new to programming, so I am worried I may be missing something basic. I would be grateful for any advice. Thank you!
I have gotten in touch with Omar, the author of RWebLogo, and he has been really helpful in pinpointing my problems and resolving the issue.
First, he advised to run the RWebLogo on a test sequence on the terminal:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RWebLogo/extdata/weblogo-3.3/weblogo -f test_seqs.txt -o ~/Desktop/out.pdf -F pdf
Change the base directory (everything before extdata/weblogo …) of the script above to be whatever the command below gives you in R:
system.file(package = 'RWebLogo')
I ran it and got a new error: the lack of numpy. I actually had the numpy installed but without full user privileges. After reinstalling numpy, the RWebLogo was successfully running from the terminal.
Still, the RStudio was throwing a GhostScript error. Omar suggested that there is a problem with an older version of RStudio running on Yosemite (I currently have 10.10.1), and sent me a link to an updated RStudio version where the problem was fixed.
http://www.r-bloggers.com/r-and-rstudio-incompatibility-with-yosemite-mac-os-x-10-10/
I got the updated RStudio and everything works great there right now. Hope this helps someone with a similar issue!

Julia error: no method haskey(Dict{String,Dict{String,String}},ASCIIString)

I'm trying to test out the Winston plotting engine in Julia. I installed the package but I'm getting some errors now when I try to compile one of the examples:
> julia example1.jl
Warning: could not import Base.haskey into Inifile
Warning: could not import Graphics.set_source into Color
ERROR: no method haskey(Dict{String,Dict{String,String}},ASCIIString)
in read at /Users/thinkpad20/.julia/IniFile/src/IniFile.jl:41
in read at /Users/thinkpad20/.julia/IniFile/src/IniFile.jl:67
in anonymous at /Users/thinkpad20/.julia/Winston/src/Winston.jl:39
in include_from_node1 at loading.jl:88
in reload_path at loading.jl:111
in require at loading.jl:46
in include_from_node1 at loading.jl:88
in process_options at client.jl:253
in _start at client.jl:334
at /Users/thinkpad20/.julia/Winston/src/Winston.jl:31
at /Users/thinkpad20/.julia/Winston/examples/example1.jl:3
can anyone tell me what's going on? It seems to be that it can't find Base.haskey, but I'm not sure how to address that.
Try inspecting Base.VERSION
haskey was introduced in Julia v0.2 (still pre-release as of this writing), I suspect that you are running a version 0.1.x
The real problem is inside of the Winston package. It sounds like they have their REQUIRES information set up wrong. You should file an issue here: https://github.com/nolta/Winston.jl
You can also download pre-release version of 0.2 for windows and mac here: https://code.google.com/p/julialang/downloads/list

Resources