I am trying to run the python file generated by GNU Radio Companion (GRC) without using GRC GUI (from Pycharm IDE). I also set the interpreter accordingly, where the gnu radio has been installed (C:\Program Files\GNURadio-3.8\gr-python27\python.exe). But I am getting this below error still:
"C:\Program Files\GNURadio-3.8\gr-python27\python.exe" "C:/Users/thangaraj/GNU Radio/AM_Demod.py"
Traceback (most recent call last):
File "C:/Users/thangaraj/GNU Radio/AM_Demod.py", line 10, in <module>
from gnuradio import gr
ImportError: No module named gnuradio
Any help will be very much appreciated!
Regards,
Thangaraj
The answer to the title
How to run python files (.py) generated by gnu-radio companion independently (without GRC GUI)?
is:
GRC just generates a python script that you can execute. You don't need the GRC UI to execute that at all.
The answer to the question you're asking is:
of course you need GNU Radio as is; you've not set up the paths to the GNU Radio Python modules correctly, which is why Python can't find the gnuradio module, exactly as the error message. You want to look into how the link/script that you use to start GRC does that, especially setting the PYTHONPATH environment variable.
I'm trying to build the PiPhone ^1, but when I execute python piphone.py, I receive the following:
I cannot seem to find anyone else who has experienced this problem. What are ways you all suggest I resolve this?
https://github.com/climberhunt/PiPhone
I've used pip uninstall serial but I haven't gotten very far solution-wise.
Traceback (most recent call last):
File "ttest.py", line 2, in <module>
import serial
File "/home/pi/.local/lib/python2.7/site-
packages/serial/__init__.py", line 10, in <module>
from . import utilities, abc, model, marshal, errors,
properties, meta, hooks, test, request
File "/home/pi/.local/lib/python2.7/site-
packages/serial/model.py", line 11, in <module>
from .utilities.compatibility import backport,
BACKWARDS_COMPATIBILITY_IMPORTS
ImportError: No module named utilities.compatibility
You installed the wrong package. You have installed serial, which is a Python package to handle object serialisation and deserialisation from and to YAML, JSON and XML and appears to be broken at the moment (I don't think the author is all that experienced in Python package development yet). Someone else already filed an issue with the package to have it renamed.
You want to install pyserial instead, which is a library to handle serial port connections.
I have a Visual Studio project. It contains several Python files. One of them is the main.py. It is working great when I right-click the main.py file in Visual Studio, and start it "with/without Debugging".
But if try to run it via cmd like this: "python main.py"
it gives me this error:
Traceback (most recent call last):
File "main.py", line 6, in <module>
from units.predefined import define_units
ImportError: No module named units.predefined
Somehow it does not find the modules when I try to execute the Python file via cmd. Does someone know why it is not finding the modules? It would be great if someone could help me :)
I am currently using Python 2.7 and my OS is Windows 7. While attempting to use the Bloomberg API I am getting this error:
Traceback (most recent call last):
File "datagrab.py", line 1, in <module>
import blpapi, time, json
File "C:\Python27\lib\blpapi\__init__.py", line 5, in <module>
from .internals import CorrelationId
File "C:\Python27\lib\blpapi\internals.py", line 50, in <module>
_internals = swig_import_helper()
File "C:\Python27\lib\blpapi\internals.py", line 42, in swig_import_helper
import _internals
ImportError: No module named _internals
I have set my path variable to point to blpapi3_64.dll and also updated my bloomberg terminal. I have also moved the local blpapi API to a different directory but still the problem exists.
I am kind of new to this API in general. So can someone please guide me?
Thank you in advance!
From your question is sounds like maybe you have tried this, but just outlining one possible solution from the README in the Python Supported Release release available here.
Note that many Python installations add the current directory to the
module search path. If the Python interpreter is invoked from the
installer directory, such a configuration will attempt to use the
(incomplete) local blpapi directory as a module. If the above
import line fails with the message Import Error: No module named
_internals, move to a different directory before invoking python.
I know this question is a bit stale, but in case people end up here like me. Do you have the C++ version of blpapi? it is a requirement for the python api as mentioned here: https://www.bloomberg.com/professional/support/api-library/
so download the C++ zip installer, extract somewhere, and then add it as an environment variable so that the python api can find it:
Environment variable name: BLPAPI_ROOT
Value: C:\blp\blpapi_cpp_3.8.18.1 (THIS IS WHERE MINE IS INSTALLED, YOUR VALUE HERE MAY BE DIFFERENT)
Hope that helps!
I cannot successfully run the first command in the Scrapy tutorial (http://doc.scrapy.org/en/latest/intro/tutorial.html). The code copy pasted below is the result (with the error at the end).
Python 2.7 is installed, and I followed the installation instructions for scrapy (http://doc.scrapy.org/en/latest/intro/install.html). I am running Python 2.7.6 32 bit on Windows 7 (64 bit).
Other aspects of installation:
Twisted-13.2.0.dist-info
zope.interface-4.1.1-py2.7
Scrapy-0.22.2-py2.7
lxml-3.3.3-py2.7
cssselect-0.9.1-py2.7
cryptography-0.3.dist-info
pyOpenSSL-0.14-py2.7
pywin32_system32
And here's the error message:
C:\Python27\Scripts>scrapy startproject tutorial
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 3, in <module>
from twisted.internet import reactor, defer
File "twisted\internet\reactor.py", line 38, in <module>
from twisted.internet import default
File "twisted\internet\default.py", line 56, in <module>
install = _getInstallFunction(platform)
File "twisted\internet\default.py", line 50, in _getInstallFunction
from twisted.internet.selectreactor import install
File "twisted\internet\selectreactor.py", line 18, in <module>
from twisted.internet import posixbase
File "twisted\internet\posixbase.py", line 24, in <module>
from twisted.internet import error, udp, tcp
File "twisted\internet\tcp.py", line 29, in <module>
from twisted.internet._newtls import (
File "twisted\internet\_newtls.py", line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "twisted\protocols\tls.py", line 40, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
File "build\bdist.win32\egg\OpenSSL\__init__.py", line 8, in <module>
File "build\bdist.win32\egg\OpenSSL\rand.py", line 11, in <module>
File "build\bdist.win32\egg\OpenSSL\_util.py", line 4, in <module>
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", l3, in __init__
self._ensure_ffi_initialized()
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", l9, in _ensure_ffi_initialized libraries)
File "C:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", line 77, ind_ffi
ext_package="cryptography",
File "C:\Python27\lib\site-packages\cffi\api.py", line 341, in verify
lib = self.verifier.load_library()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 75, in load_library
return self._load_library()
File "C:\Python27\lib\site-packages\cffi\verifier.py", line 151, in _load_library
return self._vengine.load_library()
File "C:\Python27\lib\site-packages\cffi\vengine_cpy.py", line 138, in load_library
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing 'C:\\Python27\\lib\\site-packages\\cryptogr
\_Cryptography_cffi_48bbf0ebx93c91939.pyd': DLL load failed: The operating system cannot
1.**
I just reinstall cryptography to make it work.
pip uninstall cryptography
pip install cryptography
I had this problem due to another (older?) version of libeay32.dll and ssleay32.dll being on the PATH before those of my own OpenSSL 1.0.1g installation. I recommend you use Process Monitor from SysInternals to monitor python.exe to see where it is actually loading your OpenSSL DLLs from.
In my case, the offender was some Intel components at C:\Program Files (x86)\Intel\iCLS Client\ that came with my drivers. After moving my own OpenSSL bin directory earlier in the PATH environment variable, everything worked as expected.
this is due to _Cryptography_cffi_48bbf0ebx93c91939.pyd depends on openssl dll ssleay32.dll and libeay32.dll. after you compile openssl on windows, u can copy these 2 files to system32.
#crazyzh1984's method is a little complex, but his supplement that posted at the bottom of his answer is very useful. I download the "Win32 OpenSSL v1.0.1g Light" at http://slproweb.com/products/Win32OpenSSL.html and then I could install pyOpenSSL successfully.
#lambokini is right,but i'cant comment on the answer, so come this one.
First download openssl source from http://www.openssl.org/
Second start "Visual Studio Command Prompt", compile and install openssl follow install guide(INSTALL.W32 or INSTALL.W64).
Then add "[openssl install path]\bin" to the environment variable "path",
and you can delete ssleay32.dll and libeay32.dll under system32.
Notice: dll will be load from the first place it seached.
for exmple: Path=xxx;d:\PHP5;d:\openssl\bin;
if ssleay32.dll and libeay32.dll also appears under PHP5,
then python will load that one.
I'll write my own take on this due to my extreme frustration and hopes that this might help some other poor chap with his issues getting scrapy to work on windows..
Had a similar issues with faulty libeay32.dll and ssleay32.dll, or so it would seem, but confirmed it with Process Monitor.
It all went to hell after those dll's were found in System32:
So i wasnt suffering from wrong PATHs (but i did change their order so system32 comes before C:\Program Files (x86)\Intel\iCLS Client\.
Next i used this site the other guys here pointed to. Ive used Win32 OpenSSL v1.0.2j Light, since the newer one (1.1.0b) didnt generate these dlls for me for some reason.
Generate them in a different bin folder so you see they are new, and then copy them to system32. Voila, scrapy command line works.
Also, as of today, anaconda's scrapy 1.1.2 does not create a key file for running scrapy commands, ive opened and closed a question about this issue here.
As others have said above, there are two .dll files that are loaded instead of the openssl that is downloaded with Scrapy. Those two .dll files are not compatible.
I resolved this by placing the downloaded .dll files (i used Anaconda to install scrapy) as a higher priority in the Environment Variables as shown in the attached image.
In Environment Variables, within System Variables and the "Path" i placed the Anaconda3 location as shown above at the top and therefore makes it the priority when python comes to load openssl
As already mentioned in the other answers, the issue is caused by the two files ssleay32.dll and libeay32.dll.
The error occurred when importing OpenSSL in Python
>>> from OpenSSL import crypto, SSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
ImportError: DLL load failed: The operating system cannot run %1.
Here's how I solved the issue on Windows 10. If you have git for Windows (download here) you can just copy these two files from Git\mingw64\bin\ to some location in your path. What worked for me was to copy them to c:\Windows (or else to the folder from which you're starting Python).
To find the locations of the dll files type at a cmd prompt:
>where libeay32.dll
C:\Program Files (x86)\Intel\TXE Components\TCS\libeay32.dll
...
C:\Users\me\AppData\Local\Programs\Git\mingw64\bin\libeay32.dll
I ran across this error today on a Windows 7 system. The problem for me was similar to #user2314737, #voetsjoeba, and #Olegp. libeay32.dll and ssleay32.dll where in folders related to Intel that were in the Windows path environmental variable.
Unfortunately, my system is locked (work computer), so I could not move the files or alter the system's path variable. Instead, I manually removed the Intel related items from the path variable that Python accesses using:
import os
os.environ['path'] = ';'.join(
filter(lambda x: 'intel' not in x.lower(), os.environ['path'].split(';'))
)
import OpenSSL