NXP's NFC card reader PNEV512R (https://www.nxp.com/products/rfid-nfc/nfc-hf/nfc-readers/explore-nfc-exclusive-from-element14:PNEV512R) does not work with my new raspberry pi 4.
Kernel:
Linux AlexPi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux
Release:
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux" VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
For installing the needed software I followed this manual: https://github.com/svvitale/nxppy
Installation was without any fails. But even the instantiation of Mifare raises an exception.
Python Code:
import nxppy
mifare=nxppy.Mifare()
Exception:
nxppy.InitError: Nxppy: Unknown Error from Undefined Component
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "nfc.py", line 3, in <module>
mifare=nxppy.Mifare()
SystemError: <class 'nxppy.Mifare'> returned a result with an error set
The SPI was switched on of course. ^^ And I tested the interface with the loopbacktest: https://elinux.org/RPi_SPI
So SPI is working. On my Raspbarry Pi 3B+ everything works fine. Now I am looking for a solution to fix this problem.
Related
When I run in 32 bit python,
import pyvisa
rm = pyvisa.ResourceManager()
I get this error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyvisa\highlevel.py", line 3015, in new
visa_library = open_visa_library(visa_library)
File "C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyvisa\highlevel.py", line 2929, in open_visa_library
return cls(argument)
File "C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyvisa\highlevel.py", line 175, in new
raise OSError("Could not open VISA library:\n" + "\n".join(errs))
OSError: Could not open VISA library:
function 'viOpen' not found
Here is what I have tried so far:
re-installed with pip
$ pip install -U pyvisa
Here is some info of the install:
python -m visa info
C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\lib\site-packages\visa.py:13: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace import visa by import pyvisa as visa to achieve the same effect.
The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
warnings.warn
Machine Details:
Platform ID: Windows-10-10.0.18362-SP0
Processor: Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
Python:
Implementation: CPython
Executable: C:\Users\latshaw\AppData\Local\Programs\Python\Python38-32\python.exe
Version: 3.8.5
Compiler: MSC v.1926 32 bit (Intel)
Bits: 32bit
Build: Jul 20 2020 15:43:08 (#tags/v3.8.5:580fbb0)
Unicode: UCS4
PyVISA Version: 1.11.3
Backends:
ivi:
Version: 1.11.3 (bundled with PyVISA)
#1: C:\windows\system32\visa32.dll:
found by: auto
bitness: 32
Could not get more info:
function 'viOpen' not found
I am not sure what is going wrong here. From my research, it seems that the biggest 2 ways that people make mistakes are in mismatching a 32 version of pyvisa and a 64 bit version of IDLE (both of mine are 32 bit) and the other is in naming the file visa.py (which I am not doing).
Any help is greatly appreciated, cheers!
After some more digging, I found that this is a problem for python 3.8 as it does not load the DLL files correctly (something about an environmental PATH). In my specific case, I am interested in loading the keysight visa, so the below works for me.
import os
os.add_dll_directory('C:\\Program Files (x86)\\Keysight\\IO Libraries Suite\\bin')
import pyvisa
rm = pyvisa.ResourceManager('ktvisa32')
and now rm returns:
rm <enter>
<ResourceManager(<IVIVisaLibrary('ktvisa32')>)>
I think that this is the fix to my problem. However, I am running 'offline' right now and am not able to access the key-sight test equipment to see if I can talk to them over the python scripts. My fingers are crossed :)
Thanks for reading :)
I'm trying to run a python script automatically via crontab on Mac.
25 12 * * * sh /Users/simonwe/PycharmProjects/crawlerzon/crawler.sh
The scripts looks like this
#!/bin/sh
export PYTHONPATH=/Users/simonwe/opt/anaconda3/bin/python
python /Users/simonwe/PycharmProjects/crawlerzon/crawler.py
When I run it manually in terminal everything works fine, but in crontab it gives me this Error:
From simonwe#Simons-iMac.local Wed Aug 19 12:25:02 2020
X-Original-To: simonwe
Delivered-To: simonwe#Simons-iMac.local
From: simonwe#Simons-iMac.local (Cron Daemon)
To: simonwe#Simons-iMac.local
Subject: Cron <simonwe#Simons-iMac> sh /Users/simonwe/PycharmProjects/crawlerzon/crawler.sh
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=simonwe>
X-Cron-Env: <USER=simonwe>
Date: Wed, 19 Aug 2020 12:25:01 +0200 (CEST)
Traceback (most recent call last):
File "/Users/simonwe/PycharmProjects/crawlerzon/crawler.py", line 4, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
I also tried running the .py file specifying the Path of the interpreter im using.
00 13 * * * /Users/simonwe/opt/anaconda3/bin/python /Users/simonwe/PycharmProjects/crawlerzon/crawler.py
but I seems to ignore the command entirely.
I found similar questions but tried all the answers:
Happy for your advise!
Try using the full python path.
/usr/bin/python /Users/simonwe/PycharmProjects/crawlerzon/crawler.py
To find out where python is
where python to find your python.
But, my doubt here is that you have multiple pythons. And you have to point to the right one.
If you're still not sure, just list the pythons packages of each python you have using.
python -c 'help("modules")'
And then run your python, with correct one.
Because as I see above, you have a default python installed and an anaconda python as well. So by default, your code will point to the Linux python2.7 by default. That's the problem here.
I'm writing scripts to control test equipment. I've been using the visa library to create handles for the equipment. Everything has been working fine for a while until recently when I try to open my first resource in my code, it takes about 5 minutes before it finishes. Once the first equipment is open, the rest are fine.
The code goes something like:
import visa
rm = visa.ResourceManager()
equip1 = rm.open_resource(equip1_address)
equip2 = rm.open_resource(equip2_address)
I stepped through the code and found that it locks up in a functions.py file, in the open_default_resource_manager(library) function, at this line:
ret = library.viOpenDefaultRM(byref(session))
Here's my "python -m visa info":
Machine Details:
Platform ID: Windows-7-6.1.7601-SP1
Processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
Python:
Implementation: CPython
Executable: C:\python27\python.exe
Version: 2.7.17
Compiler: MSC v.1500 64 bit (AMD64)
Bits: 64bit
Build: Oct 19 2019 21:01:17 (#v2.7.17:c2f86d86e6)
Unicode: UCS2
PyVISA Version: 1.10.1
Backends:
ni:
Version: 1.10.1 (bundled with PyVISA)
#1: C:\Windows\system32\visa32.dll:
found by: auto
bitness: 64
Vendor: National Instruments
Impl. Version: 14680064
Spec. Version: 5243904
#2: C:\Windows\system32\visa64.dll:
found by: auto
bitness: 64
Vendor: National Instruments
Impl. Version: 14680064
Spec. Version: 5243904
For those familiar with Keysight Connection Expert, this is probably related. When I try to open it, it takes forever to load as well. Probably also having trouble locating the equipment?
working with OpenCV-python and the aruco library for a tracking project.
The following error is thrown when using
rvecs,tvecs = aruco.estimatePoseSingleMarker(corners, 0.1765, cameraMatrix, distcoefs)
error:
AttributeError: 'module' object has no attribute 'estimatePoseSingleMarker
others work fine
aruco.Dictionary_get(aruco.Dict_6x6_250)
aruco.DetectParameters_create()
any idea why its throwing that error?
>>> cv2.__version__
'3.2.0-dev'
odroid#odroid:~$ python --version
Python 2.7.12
odroid#odroid:~$ uname -a
Linux odroid 3.10.104-126 #1 SMP PREEMPT Tue Nov 29 22:24:16 UTC 2016
armv7l armv7l armv7l GNU/Linux
edit: its in the help documentation
help(cv2.aruco)
Help on module cv2.aruco in cv2:
NAME
cv2.aruco
FILE
(built-in)
FUNCTIONS
estimatePoseSingleMarkers(...)
estimatePoseSingleMarkers(corners, markerLength, cameraMatrix,
distCoeffs[, rvecs[, tvecs[, _objPoints]]]) -> rvecs, tvecs,
_objPoints
the module is aruco.estimatePoseSingleMarkers with an s at the end
Objective:
Trying to run SL4A facade APIs from python shell on the host system (windows 7 PC)
My environment:
1. On my windows 7 PC, i have python 2.6.2
2. Android sdk tools rev 21, platform tools rev 16
3. API level 17 supported for JB 4.2
4. I have 2 devices ( one running android 2.3.3 and another android 4.2.2) both running Python for android and SL4A
I'm trying these commands as specified at http://code.google.com/p/android-scripting/wiki/RemoteControl
Here are the commands which i'm trying on the python shell:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import android
>>> droid=android.Android
>>> droid.makeToast("Hello")
Traceback (most recent call last):
File "", line 1, in
AttributeError: type object 'Android' has no attribute 'makeToast'
Before this i'm performing the port forwarding and starting a private server as shown below
$ adb forward tcp:9999 tcp:4321
$ set AP_PORT=9999
Also set the server on the target listening on port 9999 ( through SL4A->preferences->serverport.
Please help to understand where i'm doing mistake which gives the above error while trying droid.makeToast("Hello") ?
Try
import android
droid=android.Android()
droid.makeToast("Hello")
(you are missing parentheses after android.Android)
Hope you solved the problem. This is what I found, so maybe for somebody else it will be useful.
You need to run all your commands inside the DOS shell...otherwise you will get that error[11001].
If you still want to run you commands outside the DOS shell - add a new environment variable as described here:
http://www.smartphonedaq.com/installation.page