What is python?
I found the hp folder containing large python in my windows vista. It is necessary, I use it now (I already uninstalled program). could anything I look for it? Msconfig or task of spectators doesn't help not and error reports continue to grow.
Tags: Windows
Similar Questions
-
Python is supported by windows?
Why is python claimed not to be supported by Microsoft?
See http://bugs.python.org/issue25947.
Hello
You can use Python, but why would it be supported by Microsoft.
This is a 3rd party programming language and is a software open source.
http://www.howtogeek.com/197947/how-to-install-Python-on-Windows/
What is Python?
Open source
Python is developed under OSI-approved open source license, making it usable, and freely distributable, even for commercial purposes. Python license is administered by the Python Software Foundation.
@@@@@@@@@@@@@@@@@@@@@
For any other question of server software:
Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.
http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer
See you soon.
-
Script to run Python with EEM on Nexus 9K
Hello!
I am trying to run the example provided in the following link for "Running Scripts with Embedded Event Manager":
http://www.Cisco.com/c/en/us/TD/docs/switches/Datacenter/nexus9000/SW/6-...
Here is my configuration of the Nexus 9 K switch EEM:
NX9K-autonomous-Pod-1 # sh run EEM
! Command: show running-config EEM
! Time: Sat Nov 15 09:54:52 2014version 6.1 (2) I3 (1)
Event Manager applet a1
cli event corresponds to "display the clock.
Action 1 cli python bootflash:pydate.py
2 default event action
Action 3 syslog msg I like EEMAnd here is an example of work of pydate.py that I grabbed from GitHub:
GitHub Repo: https://github.com/haya14busa/pydate/blob/master/pydate.py
NX9K-autonomous-Pod-1 # python bootflash:pydate.py
DATETIME = 2014-11-15 09:47:03
TIMESTAMP = 1416044823
DateTime: 2014-11-15 09:47:03-> TimeStamp: 1416044823
TimeStamp: 1416044823-> DateTime: 2014-11-15 09:47:03
NX9K-autonomous-Pod-1 #.Finally, here is what happens when I run the command 'See the clock' in an attempt to trigger the EEM applet:
NX9K-autonomous-Pod-1 # sh clock
09:54:58.746 UTC Saturday, November 15, 2014
NX9K-autonomous-Pod-1 # 2014 Nov 15 09:54:58 NX9K-autonomous-Pod-1% VSHD-5-VSHD_SYSLOG_CONFIG_I: configured for the vty by admin on vsh.8883
2014-15 Nov 09:54:58 NX9K-autonomous-Pod-1% VSHD-5-VSHD_SYSLOG_CONFIG_I: configured for the vty by admin on vsh.8894Any help is appreciated!
The syslog message must come before the 'event' by default. As for what the Python script prints, it won't happen when she is called to the EEM. But you may like the Cisco.com article says, look at the log to make sure that the script ran.
-
Installation of ActiveState Tcl/Tk and Python 3.5.2
I installed the package 3.5.2 Python from python.org and by their recommendation went to activestate.com and downloaded and installed recommended Tcl/Tk package. When IDLE was opened it gave a message that Tcl/Tk is unstable and it appeared that the version was provided with the operating system, not that of ActiveState.com. I have more information about what I did to Pixelistes.com here: questions about installing Python.
The problem would be that I installed Python 3.5.2 until I installed the ActiveState Tcl/Tk? I found some information on when the dynamic linker chooses the Tcl/Tk framework (at the time of importation) to post a link but did not understand the consequences. I wonder if Python 3.5.2 installation before I installed the framework recommended Tcl/Tk due to the dynamic linker to link the Tcl/Tk by Apple instead. I might need to tell the linker to use the new framework. Any ideas appreciated.
When you run idle, by default, this is/usr/bin/idle that is installed with OS X (El Capitan) as the Python 2.7.10 distribution. It was compiled to find the v8.5.9 of ActiveState Tcl that Apple continues to ship.
When you installed Python 3.5.2 and I hope that you have not installed it on OS X Python existing, it was a precompiled binary distribution that cannot have been compiled about what anyone more than available executives of Tcl/Tk that were part of Mac OS X at the time. Even if you have run idle3 in this Python 3.5.2 distribution don't you may see no change in support of Tcl/Tk.
When we install Python for a like Homebrew package manager, or alternatively, generates the source code, there are parameters of generation (for example - with-tcl-tk) that tell the source Python 3.5.2 code looking for executives of Tcl/Tk and use + 8.6.4 ActiveState libraries if they are. As idle3 is compiled at the time too, he knows that he has to use the most recent available Tcl/Tk framework. This is the case with my idle3.
If you plan to build your own Python 3.5.2 you will need the latest tools of command line for (OS X El Capitan), and I encourage you to put the distribution in the tree/usr/local. I've patched and always use pythonbrew for several juggling Python distribution, as I installed v2.7.12 and 3.5.2. Two of these Python distributions I would build on ActiveState Tcl/Tk libraries.
-
I started playing with python, mainly because I just installed Sagemath, also to play with. I see python 3.5.1 is out, considering that OS X python 2.7.1, and installation of python 3 seems simple enough; However; should I really bother to install it, or just stay with supplied with 10.11 python2?
I use Zed Shaw's, Learn Python the Hard Way.
Thank you
Hello danuke,
Python is what people call a "large can-o-worms. As I understand it, there are significant between the versions 2.7 and 3 differences. If you ever had to deal with how vs trouble 2.6 2.7 was, then you might think twice about 3.5.
In any case, you should be aware that all of the Apple software, including the version of python from Apple, are off limits. All you want to do in Python, you must download your own version, even if it's the same as what ships with the operating system and use it. Apple's Python version should be used only Apple. From the point of view of the developer, it is basically paralyzed and unusable. Protection of the integrity of the system makes it impossible to install extensions and modules. And for the record, this notice applies only to Python either. You should download and build all your own software. Do NOT rely on the Apple software. You'll be sorry if you do.
-
2011 Macbook pro with Snow Leopard (8 MB RAM). I upgraded to 10.11.4 and now interactive Python (2.7.2) is broken. After you enter the two commands any (?), it crashes:
Pauls-MacBook-Pro: ~ python $ paul
Python 2.7.2 (v2.7.2:8527427914 has 2, June 11, 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (point 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
> > > x = 1
> > > y = 2
Segmentation fault: 11
Pauls-MacBook-Pro: ~ paul$
I saw the posts here and on StackOverflow, saying that this problem is corrected in python 2.7.6 but I have a few questions:
one) because it is a problem for a few years, why not upgrade the El Capitan installs a new version of python (if I understand correctly, the El Capitan installation includes)? :/ For example, instead of everyone made the upgrade (at least in some versions) with the problem individually?
Given that I apparently must upgrade to python:
(b) I saw mention of problems with the evolution of the system version of python. Can I change the version of the system (my preference), for example. 2.7.11, or do I need to install a version for my personal use?
(c) how DO I upgrad.e the version of the system, or install another version?
Thank you
It is not the system Python, which is the version 2.7.10. What you get from "which python"?
-
Python (a little) called from TS script does not work
Call the script attached teststand .py does not (code 1 output)
Execution directly - it works!
Remove the line 'f = open ('debug2.txt', 'w')' - makes work also Teststand (exit code 0).
I have another script more complex that also works when you run directly, but not teststand (code output 1).
What is going on?
import sys
f = open ('debug2.txt', 'w')
#Command line arguments are stored in the array argv list
numArgs = len (sys.argv) - 1
sum = 0#Iterate on each element and adds it to the sum
for n in range (1, len (sys.argv)):
Sum = sum + int (sys.argv [n])Print ("sum:", sum, "\n")
It is in fact related to the "working directory". I've been faced with this before with teststand.
When hard-code the path
or modification
"os.getcwd ()".
TO
"os.path.dirname (os.path.realpath(sys.argv[0])).
My python scripts work also Teststand
-
What opkg repository to use?
Have been seaching the forums and the Internet.
Direct reference me if there are or please redirect to the appropriate forum.
What is the best opkg repository to point my cRIO-9068 to? Specifically I'm wanting to install Python on the cRIO but will want to examine the other core and additional packages and available offenders.
The default repositories in /etc/opkg/*.conf point to a repository angstrom returning 404 not found with a wget by: opkg update (see below).
Note: site of deposit in the configuration file is to pings so network connectivity is confirmed. However does not meet the 80 website telnet port on which means maybe down?
Any suggestions or pointers to reference appreciated.
Thank you
opkg Config files:
Angstrom-base - feed.conf -.
SRC/gz-angstrom-base http://feeds.angstrom-distribution.org/feeds/next/ipk/eglib
Angstrom-python - feed.conf -.
# python-angstrom-src/gz http://feeds.angstrom-distribution.org/feeds/next/ipk/eg
Results of an opkg update:
Admin@NI-cRIO-9068-01a6fb7b: / etc/opkg # opkg update
Download http://feeds.angstrom-distribution.org/feeds/next/ipk/eglibc/armv7a/base/Packages.gz.
wget: server returned the error: HTTP/1.1 404 Not Found
Collected mistakes:
* opkg_download: could not download wget http://feeds.angstrom-distribution.org/feeds/next/ipk/eglibc/armv7a/base/Packages.gz, returned 1.
Admin@NI-cRIO-9068-01a6fb7b: / etc/opkg #.Thank you
Thanks Aaron,
I can't find this forum in question (still looking). Somehow you can point me to even and I'll repost there.
Thank you
-
RFmx and FetchSpectrum using Python
Hello
I'm trying to use RFmx through Python.NET. The code works until I have try to catch the spectrum using FetchSpectrum():
# create the name of the variable before you pass it to the method .NET
spectrum = RFmxSpecAnMXSpectrum# This does not work!
specAn.Spectrum.Results.FetchSpectrum (", timeout, spectrum)Here's the complete code:
import clr
import sys# location of the assemblies
assy_path = r'C:\Program files (x 86) \National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current'
sys. Path.Append (assy_path)CLR. AddReference ("NationalInstruments.RFmx.SpecAnMX.Fx40")
CLR. AddReference ("NationalInstruments.RFmx.InstrMX.Fx40")from NationalInstruments import *.
from NationalInstruments.RFmx.InstrMX import *.
from NationalInstruments.RFmx.SpecAnMX import *.# The VSA settings
resourceName = "5606_slave."
centerFrequency = 10.0e9 # Hz
referenceLevel = - 10 # dBm
externalAttenuation = 0.00 # dB
Timeout = 10 seconds #.
span = 1.0e + 6 # Hz
RBW = 100e3
averagingCount = 10instrSession = RFmxInstrMX(resourceName, '')
# configuration VSA
rbwAuto = RFmxSpecAnMXSpectrumRbwAutoBandwidth.True
rbwFilterType = RFmxSpecAnMXSpectrumRbwFilterType.Gaussian
averagingEnabled = RFmxSpecAnMXSpectrumAveragingEnabled.False
averagingType = RFmxSpecAnMXSpectrumAveragingType.Rms
#specAn = instrSession.GetSpecAnSignalConfiguration ();
specAn = RFmxSpecAnMXExtension.GetSpecAnSignalConfiguration (instrSession)
specAn.ConfigureRF('',centerFrequency,referenceLevel,externalAttenuation)
specAn.Spectrum.Configuration.ConfigureSpan('', span)
specAn.Spectrum.Configuration.ConfigureRbwFilter (", rbwAuto, rbw, rbwFilterType)
specAn.Spectrum.Configuration.ConfigureAveraging (", averagingEnabled, averagingCount, averagingType)
specAn.SelectMeasurements (", RFmxSpecAnMXMeasurementTypes.Spectrum, bool ())
specAn.Commit ("")# run acquisition
specAn.Initiate('','')# find the peak power in the spectrum
_, pkAmp, pkFreq, freqRes = specAn.Spectrum.Results.FetchMeasurement (", timeout, float (), float (), float ())
Print "peak power: dBm {:0.2f} to {:0.6f} GHz'.format(pkAmp,pkFreq*1e-9)}}""""
A .NET method may require user pass the variable name that it wishes to
change as an argument. Python is not compatible "pass by reference", but the
the variable name must exist in python, before he can be handed over to the .NET method.
The .NET method will simply point to the new instance.http://nbviewer.IPython.org/GitHub/jonnojohnson/Agilent/BLOB/master/Python_Automation/Python_Automation.ipynb
"""# create the name of the variable before you pass it to the method .NET
spectrum = RFmxSpecAnMXSpectrum# This does not work!
specAn.Spectrum.Results.FetchSpectrum (", timeout, spectrum)instrSession.Close)
Here is the error:
Traceback (most recent call changed):
File "
", line 3, in
specAn.Spectrum.Results.FetchSpectrum ("", timeout, spectrum)ArgumentException: Object of type 'System.RuntimeType' cannot be converted to type ' NationalInstruments.Spectrum'1 [System.Single] & ".
at System.RuntimeType.TryChangeType (Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.Reflection.MethodBase.CheckArguments (Object [] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, sig Signature)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture)
to Python.Runtime.MethodBinder.Invoke (inst IntPtr, IntPtr args, kw, MethodBase info, methodinfo MethodInfo [] IntPtr)Any ideas?
Ah! That's about all. Here's what worked:
spectrum = NationalInstruments.Spectrum [System.Single] (0)
_, spectrum is specAn.Spectrum.Results.FetchSpectrum('',timeout,spectrum)Here is the result and the final code for future reference:
import clr
import sys
Import os
import matplotlib.pyplot as plt
Import numpy as np# To Program Files Windows environment variable
Program_Files = os.environ ['ProgramFiles (x 86) ""]
assy_path = os.path.join (program_files,
"National Instruments",.
"MeasurementStudioVS2010,"
"DotNET"
"Assemblies."
'Current')sys. Path.Append (assy_path)
CLR. AddReference ("NationalInstruments.Common")
CLR. AddReference ("NationalInstruments.RFmx.SpecAnMX.Fx40")
CLR. AddReference ("NationalInstruments.RFmx.InstrMX.Fx40")from NationalInstruments.RFmx.InstrMX import *.
from NationalInstruments.RFmx.SpecAnMX import *.
import NationalInstruments
Import System# The VSA settings
resourceName = "5606_slave."
centerFrequency = 25.0e9 # Hz
referenceLevel = #-10 dBm
externalAttenuation = # 0.00 dB
Timeout = 10 # seconds
span = 1.0e + 6 # Hz
RBW = 100e3 # Hz
averagingCount = 10instrSession = RFmxInstrMX(resourceName, '')
# Get the model number
_, Model = instrSession.GetInstrumentModel (", Str())# configuration VSA
rbwAuto = RFmxSpecAnMXSpectrumRbwAutoBandwidth.True
rbwFilterType = RFmxSpecAnMXSpectrumRbwFilterType.Gaussian
averagingEnabled = RFmxSpecAnMXSpectrumAveragingEnabled.False
averagingType = RFmxSpecAnMXSpectrumAveragingType.Rms
specAn = RFmxSpecAnMXExtension.GetSpecAnSignalConfiguration (instrSession)
specAn.ConfigureRF('',centerFrequency,referenceLevel,externalAttenuation)
specAn.Spectrum.Configuration.ConfigureSpan('', span)
specAn.Spectrum.Configuration.ConfigureRbwFilter (", rbwAuto, rbw, rbwFilterType)
specAn.Spectrum.Configuration.ConfigureAveraging (", averagingEnabled, averagingCount, averagingType)
specAn.SelectMeasurements (", RFmxSpecAnMXMeasurementTypes.Spectrum, bool ())
specAn.Commit ("")# run acquisition
specAn.Initiate('','')# get x data
spectrum = NationalInstruments.Spectrum [System.Single] (0)
_, spectrum is specAn.Spectrum.Results.FetchSpectrum('',timeout,spectrum)# get data
analogwaveform = NationalInstruments.AnalogWaveform [System.Single] (0)
_, analogwaveform is specAn.Spectrum.Results.FetchPowerTrace('',timeout,analogwaveform)close a session #.
instrSession.Close)# calculate the frequency and power
startFrequency = spectrum. StartFrequency
frequencyIncrement = spectrum. FrequencyIncrement
sampleCount = spectrum. SampleCount
stopFrequency = startFrequency + frequencyIncrement *(sampleCount+1)
freqArray = np.linspace (startFrequency, stopFrequency, sampleCount)
current = list (analogwaveform. GetRawData())results of tracking #.
XScale = 1e-3
PLT. Plot ((freqArray-centerFrequency) * XScale, Power, LineWidth = 2.0)
#plt.ylim(referenceLevel-100.,referenceLevel)
PLT.yticks (NP.linspace(referenceLevel-100.,referenceLevel,11))
PLT.xticks(NP.linspace(-span,span,11)/2*XScale)
PLT. XLIM(-span/2*XScale,span/2*XScale)
PLT. Grid (true)
PLT.xlabel (' from center frequency (kHz) ")
PLT.ylabel ('Power (dBm) ")
PLT.title ("{} {:0.6f} GHz spectrum".format(model,centerFrequency*1e-9), fontsize = 'medium')
PLT. Show() -
Nican.dll call python questions
Hi all
I have a feeling that this issue will be left without an answer, but I'll ask anyway.
For a project, I need to use Python2.7 to receive frames from a bus. What I have to do is monitor CAN all traffic on the bus, I have to send frames. I searched (and searched and searched) for some sort of solution to this, but have found none. Here's the code I have so far:
Test #CAN using Python
types import *.
import table *.#Load DLL
CANdll = cdll. LoadLibrary ("NICAN.dll")canName = c_char_p ("CAN0")
canNumAttr = c_ulong (8)# Define constants
NC_TRUE = c_ulong (1)
NC_TRUE = c_ulong (0)
NC_CAN_MASK_STD_DONTCARE = c_ulong (0x00000000)
NC_CAN_MASK_XTD_DONTCARE = c_ulong (0x00000000)# The values taken from nican.h
#NC_ATTR_BAUD_RATE = c_ulong (0 x 80000007)
#NC_ATTR_START_ON_OPEN = c_ulong (0 x 80000006)
#NC_ATTR_READ_Q_LEN = c_ulong (0 x 80000013)
#NC_ATTR_WRITE_Q_LEN = c_ulong (0 x 80000014)
#NC_ATTR_CAN_COMP_STD = c_ulong (0 x 80010001)
#NC_ATTR_CAN_MASK_STD = c_ulong (0 x 80010002)
#NC_ATTR_CAN_COMP_XTD = c_ulong (0 x 80010003)
#NC_ATTR_CAN_MASK_XTD = c_ulong (0 x 80010004)# instantiate the table a
canAttrIdList = (c_ulong * 8))# Fill the values in the table
canAttrIdList [0] = c_ulong (0 x 80000007)
canAttrIdList [1] = c_ulong (0 x 80000006)
canAttrIdList [2] = c_ulong (0 x 80000013)
canAttrIdList [3] = c_ulong (0 x 80000014)
canAttrIdList [4] = c_ulong (0 x 80010001)
canAttrIdList [5] = c_ulong (0 x 80010002)
canAttrIdList [6] = c_ulong (0 x 80010003)
canAttrIdList [7] = c_ulong (0 x 80010004)#NC_ATTR_BAUD_RATE = 500000
#NC_ATTR_START_ON_OPEN = NC_TRUE
#NC_ATTR_READ_Q_LEN = 100
#NC_ATTR_WRITE_Q_LEN = 0
#NC_ATTR_CAN_COMP_STD = 0
#NC_ATTR_CAN_MASK_STD = NC_CAN_MASK_STD_DONTCARE
#NC_ATTR_CAN_COMP_XTD = 0
#NC_ATTR_CAN_MASK_XTD = NC_CAN_MASK_XTD_DONTCARE# instantiate table a
canAttrValueList = (c_ulong * 8)# Fill the values in the table
canAttrValueList [0] = 500000
canAttrValueList [1] = NC_TRUE
canAttrValueList [2] = 100
canAttrValueList [3] = 0
canAttrValueList [4] = 0
canAttrValueList [5] = NC_CAN_MASK_STD_DONTCARE
canAttrValueList [6] = 0
canAttrValueList [7] = NC_CAN_MASK_XTD_DONTCAREreturnValue = CANdll.ncConfig (canNumAttr, canAttrIdList, canName, canAttrValueList)
CODE ##END
Which causes this error:
Traceback (most recent call changed):
File "C:\Users\Chadwick\Dropbox\Senior Project\CAN\NI-CAN\ITB CAN\test.py", line 63, in
returnValue = CANdll.ncConfig (canNumAttr, canAttrIdList, canName, canAttrValueList)
ValueError: Procedure called with not enough arguments (missing 16 bytes) or bad calling conventionIt seems that I am not calling the function correctly.
Yes, I understand that nor is not supported by the Python. However, any help with this is appreciated.
Thank you
He is the labour code. I question the material for how many images of waiting there, then read them individually as I'm having no luck using ncReadMult. If someone needs to do this, here's a starting point.
/thread
types import *.
import table *.
import sys
import of struct
time of import#Load DLL
CANdll = windll. LoadLibrary ("NICAN.dll")NC_ST_READ_AVAIL = c_ulong (0x00000001)
NC_ATTR_READ_PENDING = c_ulong (0 x 80000011)# HEADER INFORMATION RELEVANT C
# typedef NCTYPE_INT32 NCTYPE_STATUS;
# typedef NCTYPE_UINT32 NCTYPE_OBJH;##typedef struct {}
# NCTYPE_ABS_TIME Timestamp;
# NCTYPE_CAN_ARBID ArbitrationId;
# FrameType NCTYPE_UINT8;
# NCTYPE_UINT8 DataLength;
# NCTYPE_UINT8 data [8];
#} NCTYPE_CAN_STRUCT;class CAN_STRUCT (Structure):
_fields_ = [("Timestamp", c_ulonglong),
("ArbitrationId", c_ulong);
("Frames", c_ubyte);
('DataLength', c_ubyte);
(«Données», c_ubyte * 8)]CAN_receive_buffer = (CAN_STRUCT * 1000))
Status = c_long (0)
CAN_HANDLE = c_ulong (0)
#CAN_data_size = c_ulong (sys.getsizeof (CAN_receive_buffer))
CAN_data_size = c_ulong (17600)CAN_received_size = c_ulong (1)
CAN_NAME = c_char_p ("CAN0")
canNumAttr = c_ulong (8)# Define constants
NC_TRUE = c_ulong (1)
NC_FALSE = c_ulong (0)
NC_CAN_MASK_STD_DONTCARE = c_ulong (0x00000000)
NC_CAN_MASK_XTD_DONTCARE = c_ulong (0x00000000)# The values taken from nican.h
#NC_ATTR_BAUD_RATE = c_ulong (0 x 80000007)
#NC_ATTR_START_ON_OPEN = c_ulong (0 x 80000006)
#NC_ATTR_READ_Q_LEN = c_ulong (0 x 80000013)
#NC_ATTR_WRITE_Q_LEN = c_ulong (0 x 80000014)
#NC_ATTR_CAN_COMP_STD = c_ulong (0 x 80010001)
#NC_ATTR_CAN_MASK_STD = c_ulong (0 x 80010002)
#NC_ATTR_CAN_COMP_XTD = c_ulong (0 x 80010003)
#NC_ATTR_CAN_MASK_XTD = c_ulong (0 x 80010004)
#NC_ATTR_LISTEN_ONLY 0 X 80010010# instantiate the table a
canAttrIdList = (c_ulong * 9))# Fill the values in the table
canAttrIdList [0] = c_ulong (0 x 80000007)
canAttrIdList [1] = c_ulong (0 x 80000006)
canAttrIdList [2] = c_ulong (0 x 80000013)
canAttrIdList [3] = c_ulong (0 x 80000014)
canAttrIdList [4] = c_ulong (0 x 80010001)
canAttrIdList [5] = c_ulong (0 x 80010002)
canAttrIdList [6] = c_ulong (0 x 80010003)
canAttrIdList [7] = c_ulong (0 x 80010004)
canAttrIdList [8] = c_ulong (0 x 80010010)#NC_ATTR_BAUD_RATE = 500000
#NC_ATTR_LISTEN_ONLY = NC_TRUE
#NC_ATTR_READ_Q_LEN = 100
#NC_ATTR_WRITE_Q_LEN = 0
#NC_ATTR_CAN_COMP_STD = 0
#NC_ATTR_CAN_MASK_STD = NC_CAN_MASK_STD_DONTCARE
#NC_ATTR_CAN_COMP_XTD = 0
#NC_ATTR_CAN_MASK_XTD = NC_CAN_MASK_XTD_DONTCARE# instantiate table a
canAttrValueList = (c_ulong * 9)# Fill the values in the table
canAttrValueList [0] = 500000
canAttrValueList [1] = NC_TRUE
canAttrValueList [2] = 100
canAttrValueList [3] = 0
canAttrValueList [4] = 0
canAttrValueList [5] = NC_CAN_MASK_STD_DONTCARE
canAttrValueList [6] = 0
canAttrValueList [7] = NC_CAN_MASK_XTD_DONTCARE
canAttrValueList [8] = NC_FALSE# Configure the equipment CAN
Status = CANdll.ncConfig (canNumAttr, canAttrIdList, CAN_NAME, canAttrValueList)
If Status! = 0 :
"Printing on"ncConfig"error
Status of printingStatus = CANdll.ncOpenObject (CAN_NAME, byref (CAN_HANDLE))
If Status! = 0 :
"Printing on"ncOpenObject"error
Status of printing
impression CAN_HANDLE.valueTime.Sleep (1)
Try:
Status = CANdll.ncAction (CAN_HANDLE, c_ulong(0x80000001), 0)
If Status! = 0 :
"Printing on"ncAction:start"error
Status of printing
impression CAN_HANDLE.valueI have = 0
##string = "" data: "".
String = «»pending_CAN_frames = c_ulong (0)
while I<>
Status = CANdll.ncGetAttribute (CAN_HANDLE, NC_ATTR_READ_PENDING,
32, byref (pending_CAN_frames))
Print "waiting for frames: %d" % pending_CAN_frames.value
If Status! = 0 :
"Printing on"ncGetAttribute"error
Status of printing
for n in range (0, pending_CAN_frames.value):
Status = CANdll.ncRead (CAN_HANDLE, CAN_data_size,
ByRef (CAN_receive_buffer [n]))
for n in range(0,pending_CAN_frames.value):
for j in range (0, CAN_receive_buffer [n]. DataLength):
String = string + '%x' % (CAN_receive_buffer [n]. Data [j])
print '% X\t%d\t%s' % (CAN_receive_buffer [n]. ArbitrationId, CAN_receive_buffer [n]. DataLength, string)
String = ' ' #reset chain
I += 1# ALWAYS CALL LAST
Finally:
Status = CANdll.ncCloseObject (CAN_HANDLE)
If Status! = 0 :
"Printing on"ncCloseObject"error
Status of printing/thread
I hope this helps someone in the future.
-
I'm trying to use Python to call a .seq file, wait until the sequence is done, and then resume the Python script. I got everything to work it seems however my problem is when I make the Engine.NewExecution seems not to run the movie file and WaitForEndEx to expire. (Time for my movie file is about 50 seconds).
What I am doing wrong?
Python code:
testStandEngine = win32com.client.Dispatch ("TestStand.Engine.1")
sequenceFileObject = testStandEngine.GetSequenceFileEx ("C:\\...\\SIL Version .13\\Teststand Primitives\\ShutDown Target.seq")
testStandExecution = testStandEngine.NewExecution (sequenceFileObject, "MainSequence", sequenceFileObject, False, 0)
testStandExecution.WaitForEndEx (60000)Hobbs,
I am able to call a movie file and get the behavior you expect with the files I enclose you.
The code is basically the same code that you have, and I just added additional logic to determine the path of the file in sequence automatically (to the zip file so that you can run it) and I removed the client file of sequence setting just so I can see if the sequence is running without the important process templates.
I've built and run with Python 2.7.1 using win32com 7 February 2012 (I wasn't able to determine where they store the version)
Hope this helps,
Francisco
-
Python, call DLLs in LabVIEW: Fatal internal error when accessing output String Cluster
Hello
We have compiled a DLL in LabVIEW (TestError.dll) and tried to call it from Python.
TestError.dll includes 2 functions:
1 testErreur: cluster 1 entry string, 1 channel indicator
2 TestError2: 1 channel input, 1 bunch of output string
What we try to do in Python is actually something like this:
1 provide values to controls in the functions of the DLL.
2. call the DLL.
3 get the values of the indicators.
What we have seen are:
1 read/write operations on normal data types (string, digital) indicators/controls are OK
2. write operation on the Cluster string entry is OK
3. read operation on the Cluster output string is not OK. The following error is still prompted for:
«Unrecoverable internal error: 'MemoryManager.cpp', line 437.» LabVIEW version 8.6... »
Also joined the TestError.prj and python code.
Grateful if someone can help to explain why we get this error and how to overcome?
Thank you
howmean
What we have seen are:
1 read/write operations on normal data types (string, digital) indicators/controls are OK
2. write operation on the Cluster string entry is OK
3. read operation on the Cluster output string is not OK. The following error is still prompted for:
«Unrecoverable internal error: 'MemoryManager.cpp', line 437.» LabVIEW version 8.6... »
Also joined the TestError.prj and python code.
It is very logical that it does not, and the bad news is, it cannot really be implemented reliable of a process not LabVIEW.
LabVIEW channels (and tables) are very specific species. They are then called handles, which are pointers to a pointer to a block of memory. If you have a control or indicator on its own, the Prototype configuration allows you to configure this setting as a C. LabVIEW data pointer, when creating the DLL, create heels C for each exported function and place the code to do the translation between the past C pointer to and necessary LabVIEW data handle. For strings and arrays within the cluster, there is no configuration option and the DLL is expected to pass a structure with data handles native LabVIEW in there.
You may say that creating handles data in your calling process enough to trick LabVIEW. For the input variables that actually CAN sometimes work (but is a delicate and dangerous generally to handle this). There is no way to make it work for output variables. LabVIEW will try to resize handle to fill data in that he wants to make. This resizing is done using internal memory manager of LabVIEW. This will work only if it had been allocated by EXACTLY the same instance of the memory manager. Otherwise, it refers to a different memory segment and catastophally fail. The only way to make this work perhaps, with luck, taking your heart and prayer to the gods, is to lvrt.dll to allocate a handle that you must pass to the DLL. Still find the good lvrt.dll, which will execute your DLL LabVIEW is a major challenge.
-
When to use c / python instead of LabVIEW
I was recently asked when you use python/c and not of LabVIEW.
As someone who has worked with LabVIEW Kool for awhile I found difficult to answer as it seems to be very few restrictions to what labVIEW can achieve.
LabVIEW is obviously ideal for test of manufacturing, control systems, rapid prototyping systems, develop ideas, and I even used to generate executables to decrypt the data of wireshark, editing MySQL databases, programs of encryption, etc..
However, in my head at the following spring to mind that could impose a project to lean towards python.
1 development license (free vs. paid)
2 drive - engine labVIEW run requires a lot of space
3 MCU / smart phones, in particular, could benefit from C / python / Java supported
Recently, I worked in a company where all R & D product development and manufacturing was done through LabVIEW but regression testing has been done through python. Truth is, I probably could have implemented the regression test in LabVIEW but generally those working environments hose int will use PHP / Python or similar and it is easier to hire a team on that basis.
I do not putting down LabVIEW rather try to honestly answer a customer's question. Any OE ideas to answer the question?
I think I can put it the way the shortest is: LabVIEW is best suited to the intervention of material.
Yes, you can write a small application of office in LabVIEW... but the obligation to install the runtime (which can be quite slow), it is difficult to create a 'portable' application (there are a lot of workarounds... but still). I don't see why even a simple "Hello World" executable should force hundreds of MB of installation.
I saw a lot of posts here who have spoken of creating applications to manage data in a database (for example a stock inventory system), or run an executable LabVIEW on a server to act as a server web - Yes, you can use LabVIEW to do these things, but there are other tools that seem much more appropriate (e.g. Apache/IIS and PHP/ASP) - essentially a nice web front end - I also have the same feeling about creating something to review test data - I think that this must be done in a more suitable tool (e.g. a web front end so anyone can access it without the need of RTÉ).
The cost of the development license is there, Yes (but not for deployment) but it is easier to justify when it is just a small part of a test/measurement system expensive. I also don't really think that the use of the disc is so important nowadays with space being so cheap HARD drive to.
I feel LabVIEWs strengths are its ability to allow no computer to write their own code to run tests (for example a DAQ in LabVIEW System prototyping takes minutes... how long take in C if you had never used before C?) for new users and allow advanced users (LabVIEW Professional) to create test/measure/search systems much more quickly they could start from scratch in C etc.
-
Development of type float NAN of Python
I am writing the Python 2.6 code that is interfaced with NI TestStand 4.2 via COM in Windows. I want to do a value "NAN" for a variable, but if I pass
float('nan')
, TestStand displays asIND
. In other words, my code was something like:locals_prop_object.NewSubProperty(var_name, win32com.client.constants.PropValType_Number, False, "", 0) # Set the initial value to NaN--although it appears in TestStand as 'IND'. locals_prop_object.SetValNumber(var_name, 0, float('nan'))
Apparently, TestStand distinguishes between floating point "IND" and "NAN" values According to TestStand help:
IND
corresponds to the signs of the NaN in Visual C++, whileNAN
corresponds to QuietNaN
It means that Python
float('nan')
is indeed a signalling NaN when passed through COM. However, from what I've read on the signaling NaN, apparently signaling NaN is somewhat "exotic" and quiet NaN is your "regular" NaN. So I have my doubts that Python would pass a signaling through COM NaN (how can I verify this?).So, any ideas how Python float ('nan') becomes TestStand "IND", the Python-> COM-> stream TestStand?
Now I tried with NI TestStand. First of all I've tried:
quiet_nan = struct.unpack(">d", "\x7f\xf8\x00\x00\x00\x00\x00\x01")[0]# Set the variable's value in TestStandlocals_prop_object.SetValNumber(var_name, 0, quiet_nan)
But that always appeared in TestStand as
IND
. So I created a TestStand file with the value of the variablesIND
andNAN
, and read values from Python. It turns out that TestStandNAN
has the valueFFFF000000000001
. According to summary graphics Kevin , it is a quiet NAN negative.Then, finally, it works (well that is probably specific to the platform; it works for me on Windows XP):
# Make a NAN suitable for TestStandteststand_nan = struct.unpack(">d", "\xff\xff\x00\x00\x00\x00\x00\x01")[0]# Set the variable's value in TestStandlocals_prop_object.SetValNumber(var_name, 0, teststand_nan)
-
Using nilibddc dll with Python types
I try to use this 'DiaDEM connectivity library' with Python to read files produced by our acquisition of data in the format *.tdms system, but examples of dll are all for C and Matlab. Has anyone else done that could give me advice? I made some progress (see below) by trial and error, but it is slow and I have to get it up and running quickly. I'm trying to reproduce the functions of the C example for reading a file (no need to write again).
I'm using Python 2.6 on a Windows XP computer.
Here's what I have so far:
------------------------------------
# Module to manage a *.tdm and a *.tdms National Instruments TDM
files in the format #.
#
types import *.#Define of the short names for the required dll functions
DDCOpen = windll.nilibddc.DDC_OpenFile
DDCNumGroups = windll.nilibddc.DDC_GetNumChannelGroups
DDCReadGroups = windll.nilibddc.DDC_GetChannelGroups
DDCGroupStrPropLen = windll.nilibddc.DDC_GetChannelGroupStringPropertyLength
DDCGroupProperty = windll.nilibddc.DDC_GetChannelGroupProperty# File handles are pointers to 32-bit integer
Czero = c_int (0)
File descriptor = point (czero)# Retrieve a handle to the file
DDCErrCode = DDCOpen (' Test_0919.tdms, 'PDM' file descriptor,)
Print (DDCErrCode) # must be zero
MyFile = real FileHandle.contents #The file handle# Find several groups
grpnum = c_int (0)
numPtr = point (grpnum)
DDCErrCode = DDCNumGroups (myFile, numptr)
Print (DDCErrCode)
# Si DDCErrCode == 0: print (numptr.contents, grpnum)# Read groups [UNTESTED]
groups = c_int (0) * grpnum
grpptr = point (groups) # must be a pointer to the memory to organize grpnum
Number of fields DDCChannelGrouphandle
DDCErrCode = DDCReadGroups (myFile, groups, grpnum)
Print (DDCErrCode)
If DDCErrCode == 0: Print (groups)# Length of name of the Group [UNTESTED]
namelen = c_int (0)
nlenptr = point (name)
DDCErrCode = DDCGroupStrPropLen (groups [0], 'name', namelen)
Print (DDCErrCode)
If DDCErrCode == 0: Print (namelen)#Make a buffer to hold the name, then get it back [UNTESTED]
grpname = create_string_buffer(namelen+1)
nameptr = point (grpname)
DDCErrCode = DDCGroupProperty (groups [0], 'name', nameptr, namelen + 1)
Print (DDCErrCode)
If DDCErrCode == 0: Print (grpname.value)# Read the Group channels and get the names [UNTESTED]
# Read the string # data values [UNTESTED]
# Read the string of data values [UNTESTED]
# Process the data values [UNTESTED]
# Write data processed in a file in a different format [UNTESTED]
------------------------------------The "TESTED" sections are more or less pseudo-code representing things I have to do for now. The others work. These will be finally in a module.
Cross-posted on some forums of Python. Thanks in advance for any help.
Kind regards
AllenCan find out:
http://Pypi.Python.org/Pypi/cTDMS/0.9
or alternative link
http://code.Google.com/p/ctdms/
They seem to be exactly what you're looking for... (two years later)
Maybe you are looking for
-
How to restore all the data stored on my Time Capsule airport to my new iPAD Pro
I have a Macbook air with a backup at a time Capsule from the airport. The MacBook Air is dead (blue screen). Now, I have a new iPad Pro and want to restore all the photos that have been saved on the Time Capsule airport to my iPad. How can I do t
-
Gel to the import screen?
Hi all. Me once again. Currently, I am trying to import images and FCPX freezes on the import screen, then I have to force quit and open it again, only so he can freeze once more when I try to import images. The program itself seems to work fine, asi
-
H8-1414 office envy: no sound
Sound has stopped working. Worked very well for weeks after the upgrade to Windows 10. I deleted the device in the device driver deletion Manager. Added. No sound rear connector or jack before (helmet). Have tested with multiple speakers and headphon
-
upgrading ram on pavilion g7 1100ev
Hello.. I want to improve my memory from 4g to 8g? any ideas? Thank you
-
I just bought a W520, i7 - 2620M, 4 G, 2000M 2 G, 320G Partition Win7 interpretation as follows: CPU: 7.1 Memory: 5.9 Graphics: 4.6 Games graphics: 6.9 Primary hard disk: 5.9 I think that Graphics Score is incorrect, since I checked some test blog an