ValueError: _type_ 'v' not supported error after installing PyReadline
As stated on their site, the PyReadline
library is Used for Windows.
Looking at the last lines of your stack trace:
import ctypes.wintypes as wintypes
File "/usr/local/lib/python2.7/ctypes/wintypes.py", line 23, in <module>
class VARIANT_BOOL(_SimpleCData):
ValueError: _type_ 'v' not supported
It is trying to import windows specific data types from ctypes
which is obviously not possible since you are not running Windows.
sqlmap with error ValueError: _type_ 'v' not supported
reinstall python,i solve my problem.
brew install python
Msys2 with python 3.8: ImportError: cannot import name 'open_code' from 'io'
The ImportError: cannot import name 'open_code' from 'io' (unknown location)
comes from the fact that there are two different versions of Python conflicting with each other. python
still points to the old version 3.7 but PYTHONPATH
got updated to point to the new 3.8 version. As the documentation of PYTHONPATH
states, it becomes prepended to the module search path and hence shadows any builtin modules:
The default search path is installation dependent, but generally begins with
prefix/lib/pythonversion
(seePYTHONHOME
above). It is always appended toPYTHONPATH
.
You can reproduce that behavior by creating two different virtual environments and then start one while having PYTHONPATH
point to the other. In the following I used Miniconda to create two different environments, py37
and py38
, containing a 3.7 and 3.8 installation respectively.
(py37) user@pc:~$ python --version
Python 3.7.6
(py37) user@pc:~$ PYTHONPATH=~/miniconda3/envs/py38/lib/python3.8/ python
Fatal Python error: init_sys_streams: can't initialize sys standard streams
Traceback (most recent call last):
File "/home/user/miniconda3/envs/py38/lib/python3.8/io.py", line 54, in <module>
ImportError: cannot import name 'open_code' from 'io' (unknown location)
Aborted (core dumped)
Pythons Console Module has made it impossible to type the tab key
Seems to be a continuing issue for Windows machines as seen on Github. A workaround seems to be uninstalling the pyreadline
package.
Python Embedding with IPython: WindowsError: [Error 193] %1 is not a valid Win32 application
Problem indeed is related to msvcr90.dll. Way to solve it is to link the program against msvcr90.dll. However, to link against msvcr90.dll you need to have a manifest or you will get a runtime error. This manifest looks like:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
which I extracted from python.exe with a text editor and named msvcr90.manifest
. This manifest is linked into the application using the resource file msvcr90.rc
#include "winuser.h"
1 RT_MANIFEST msvcr90.manifest
which in turned can be compiled into an object file using:
windres msvcr90.rc msvcr90.o
Than, compilation of the program with this resource file and msvcr90.dll becomes:
g++ -I /c/prog64/Python27/include t.cpp /c/prog64/Python27/libs/libpython27.a msvcr90.o msvcr90.dll
where I copied msvcr90.dll from c:/Windows/winsxs/amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_750b37ff97f4f68b/msvcr90.dll
Input for this came from
- https://cournape.wordpress.com/2008/09/02/how-to-embed-a-manifest-into-a-dll-with-mingw-tools-only
- Manifest being ignored in mingw app
- http://www.mingw.org/wiki/MS_resource_compiler
- https://lists.launchpad.net/kicad-developers/msg09473.html
and a couple of other web pages which explained me how to do this.
Related Topics
How to Convert Index of a Pandas Dataframe into a Column
Is There a Simple Way to Remove Multiple Spaces in a String
Equivalent to Gettickcount() on Linux
How to Get the Day of Week Given a Date
How to Read a File in Reverse Order
How to Load All Modules in a Folder
Environment Variables When Script Run by Cron
Pandas Column of Lists, Create a Row For Each List Element
Comparing a String to Multiple Items in Python
Do Not Want the Images to Load and CSS to Render on Firefox in Selenium Webdriver - Python
How to Check the Operating System in Python
What Is a Clean "Pythonic" Way to Implement Multiple Constructors
How to Simulate Input to Stdin for Pyunit
Multiprocessing: Use Only the Physical Cores