Python settings

i have two versions of python on my computer. One is a version that came with the developer(programming) tools, it is MacPython 2.5.2.
the other version i downloaded from the web. when i go into terminal i can now import scripts that i have in a folder called python in my home directory. the reason i can import these scripts is because i added a line to my .bash_profile file which was a hidden file in my home directory. I added the following line:
$ export PYTHONPATH=.:$HOME/python:$PYTHONPATH
one of my problems was that i left the $ in the line when i went to add it. i believe the dollar sign represents the prompt in a bash shell. i removed it and now i am able to import scripts when i run python from terminal. My question is why does the other version, which is in my dock, and in my Applications folder, not import my scripts. I was told that i should check the settings for the version of python which i downloaded from the internet, but am unsure of how to go about doing this. any help would be appreciated.

jamesapp wrote:
i have two versions of python on my computer. One is a version that came with the developer(programming) tools, it is MacPython 2.5.2.
What version of OS X are you running? Which version of the Developer Tools do you have? What makes you think MacPython was installed as part of the Developer Tools package?
the other version i downloaded from the web.
Where? Which package?
when i go into terminal i can now import scripts that i have in a folder called python in my home directory. the reason i can import these scripts is because i added a line to my .bash_profile file which was a hidden file in my home directory. I added the following line:
$ export PYTHONPATH=.:$HOME/python:$PYTHONPATH
one of my problems was that i left the $ in the line when i went to add it. i believe the dollar sign represents the prompt in a bash shell.
It can. By default you see a dollar sign as the last character in your prompt.
i removed it and now i am able to import scripts when i run python from terminal. My question is why does the other version, which is in my dock, and in my Applications folder, not import my scripts. I was told that i should check the settings for the version of python which i downloaded from the internet, but am unsure of how to go about doing this. any help would be appreciated.
I think you are confusing different versions of python with different interfaces for working with python. You do not have one version for Terminal and one version for the application in your Dock. Depending on your settings, these may well access the same version, though you could also set things up so they did not.
In any case, the answer to your question is that .bash_profile is read when you start a login bash shell e.g. when you fire up Terminal if bash is your default shell. The GUI application doesn't read this, so it does not read the environmental variables you set there. Depending on the application, you may be able to set PYTHONPATH via its preferences or you may need to set it in a special file in an invisible sub-directory of your home: .MacOSX/environment.plist. This is a property list file and must be kept in that format. It is a bad idea to edit this file unless you know what you are doing because all applications inherit the variables you set here and that can be dangerous. If the file is not edited correctly, it will also create lots of errors - I'm not entirely sure what the implications of those might be.
Note that you should check this information is still correct if you are using Leopard as I have not used a Leopard system.
- cfr

Similar Messages

  • BT Cloud silent update

    Good evening everyone.
    I was installing some new software today and was required to restart my Windows 7 Pro based system.
    No problem. Except that on restart I saw an error message and the system then hung.
    I restarted again and eventually worked out that the error message seems to be from BT Cloud not the installation I had just performed. My new installation works fine - once I could get to it.
    Checking the software installations and sure enough BT Cloud was reported as being updated today. Must have been a silent update as I knew nothing about it. I very rarely use it - not touched for months.
    So I uninstalled BT Cloud (158Mb - really?) and tried a re-boot (it was set to log in at start up automatically, hence the problem). No problem with this re-boot.
    So I re-downloaded and re-installed BT Cloud and  ... the error report returned at start up of the program.
     Screen Capture
    Any suggestions for resolution would be welcome.
    Is this a possible conflict in Python settings between two applications .....? Or just an error in the update apparently performed?
    gperkc

    Hi gperkc, 
    Thanks for posting.
    I'm sorry you have received an error message regarding cloud when installing new software.  I can help you with this from here. Click on my username and under the "about me" section you'll see the link to get in touch with us.
    Please include the link to this thread when you complete the form and whenever we've received your details we'll take it from there.
    Thanks
    Paul
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • USB 6009 Python Control

     Hello, 
    I am attempting to use python (with ctypes) to control my USB-6009.  The goal is to write out an analog voltage and then read in the voltage through an analog input with ability to change the number of points averaged and the number of times this is repeated(sweeps) averaging the analog input array.  The issue is that as we increase the number of times the voltage ramp is repeated (sweeps) we get a time out error (nidaq call failed with error -200284: 'Some or all of the samples requested have not yet been acquired).  This has us confused because the sweeps are in a larger loop and the Daq function should be the same if there are 10 sweeps (works) or 1000 sweeps (crashes).  Any insight would be greatly appreciated.  I have included the code below for reference.  
    import ctypes
    import numpy
    from time import *
    from operator import add
    nidaq = ctypes.windll.nicaiu # load the DLL
    # Setup some typedefs and constants
    # to correspond with values in
    # C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h
    # Scan Settings
    aoDevice = "Dev2/ao0"
    aiDevice = "Dev2/ai0"
    NumAvgPts = 10
    NumSweeps = 50
    NumSpecPts = 100
    filename = '12Feb15_CO2 Test_12.txt'
    Readrate = 40000.0
    Samplerate = 1000
    StartVolt = 0.01
    FinalVolt = 1.01
    voltInc = (FinalVolt - StartVolt)/NumSpecPts
    # the typedefs
    int32 = ctypes.c_long
    uInt32 = ctypes.c_ulong
    uInt64 = ctypes.c_ulonglong
    float64 = ctypes.c_double
    TaskHandle = uInt32
    # the constants
    DAQmx_Val_Cfg_Default = int32(-1)
    DAQmx_Val_Volts = 10348
    DAQmx_Val_Rising = 10280
    DAQmx_Val_FiniteSamps = 10178
    DAQmx_Val_GroupByChannel = 0
    def CHK_ao( err ):
    """a simple error checking routine"""
    if err < 0:
    buf_size = 100
    buf = ctypes.create_string_buffer('\000' * buf_size)
    nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),buf_size)
    raise RuntimeError('nidaq call failed with error %d: %s'%(err,repr(buf.value)))
    if err > 0:
    buf_size = 100
    buf = ctypes.create_string_buffer('\000' * buf_size)
    nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),buf_size)
    raise RuntimeError('nidaq generated warning %d: %s'%(err,repr(buf.value)))
    def CHK_ai(err):
    """a simple error checking routine"""
    if err < 0:
    buf_size = NumAvgPts*10
    buf = ctypes.create_string_buffer('\000' * buf_size)
    nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),buf_size)
    raise RuntimeError('nidaq call failed with error %d: %s'%(err,repr(buf.value)))
    def Analog_Output():
    taskHandle = TaskHandle(0)
    (nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle )))
    (nidaq.DAQmxCreateAOVoltageChan(taskHandle,
    aoDevice,
    float64(0),
    float64(5),
    DAQmx_Val_Volts,
    None))
    (nidaq.DAQmxCfgSampClkTiming(taskHandle,"",float64(Samplerate),
    DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,
    uInt64(NumAvgPts))); # means we could turn in this to continuously ramping and reading
    (nidaq.DAQmxStartTask(taskHandle))
    (nidaq.DAQmxWriteAnalogScalarF64(taskHandle, True, float64(10.0), float64(CurrentVolt), None))
    nidaq.DAQmxStopTask( taskHandle )
    nidaq.DAQmxClearTask( taskHandle )
    def Analog_Input():
    global average
    # initialize variables
    taskHandle = TaskHandle(0)
    data = numpy.zeros((NumAvgPts,),dtype=numpy.float64)
    # now, on with the program
    CHK_ai(nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle)))
    CHK_ai(nidaq.DAQmxCreateAIVoltageChan(taskHandle,aiDevice,"",
    DAQmx_Val_Cfg_Default,
    float64(-10.0),float64(10.0),
    DAQmx_Val_Volts,None))
    CHK_ai(nidaq.DAQmxCfgSampClkTiming(taskHandle,"",float64(Readrate),
    DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,
    uInt64(NumAvgPts)));
    CHK_ai(nidaq.DAQmxStartTask(taskHandle))
    read = int32()
    CHK_ai(nidaq.DAQmxReadAnalogF64(taskHandle,NumAvgPts,float64(10.0),
    DAQmx_Val_GroupByChannel,data.ctypes.data,
    NumAvgPts,ctypes.byref(read),None))
    #print "Acquired %d points"%(read.value)
    if taskHandle.value != 0:
    nidaq.DAQmxStopTask(taskHandle)
    nidaq.DAQmxClearTask(taskHandle)
    average = sum(data)/data.size
    Thanks, 
    Erin
    Solved!
    Go to Solution.

    This forum is for LabVIEW questions.

  • Python 2.5.1 in Arch

    Recently I tried to compile ardour from the PKGBUILD in abs, but the build always failed for me. Very strange, I didn't modify anything in that PKGBUILD. Later I suspected that it might be caused by default build of python 2.5.1 in Arch, but I can't make sure of whether it is the root cause or not. So I post the steps I managed to compile ardour below:
    1. I had the default build of python-2.5.1-1 and scons-0.96.95-2 installed and tried to makepkg ardour-2.0.2-1 from my /var/abs. makepkg always failed, with following error message:
    patching file libs/libsndfile/configure
    patching file libs/libsndfile/src/flac.c
    scons: Reading SConscript files ...
    scons: *** No tool named 'midl': not a Zip file
    File "/root/src/extra/multimedia/ardour/src/ardour-2.0.2/SConstruct", line 16, in <module>
    scons: Reading SConscript files ...
    scons: *** No tool named 'midl': not a Zip file
    File "/root/src/extra/multimedia/ardour/src/ardour-2.0.2/SConstruct", line 16, in <module>
    (there is a small bug in ardour's PKGBUILD; it doesn't do the error check for the building process. Whether the build is ok or not, you always get a .tar.gz package for it)
    2. First I tried to browse scons's source code and even installed the latest one from their official site(using makepkg & pacman -U). Still the same error.
    3. I guessed the problem should be related to python. Fired up python shell and was surprised to find out that there is an entry for python 2.4 site-packages in sys.path. Upon my pure guess, I used pacman to remove all the packages under my /usr/lib/python2.4/site-packages/. Now even the directory /usr/lib/python2.4 didn't exist anymore(actually I was already using my scons mentioned in step 5 in this stage), but I still got the same error when makepkg ardour.
    4. I checked the PKGBUILD and Makefile for python-2.5.1-1 and found out that the SITEPATH in Makefile would affect other python path settings(though I didn't know what these settings would do to the build process). I commented out the following line in the PKGBUILD for python and makepkg
    sed -i 's#SITEPATH=#SITEPATH=:../python2.4/site-packages#' Makefile
    5. Installed the newly compiled Python, but, unfortunately, scons-0.96.95-2 was installed to /usr/lib/python2.4/site-packages/. So I makepkged scons from source and installed my scons. (this time they were all installed to /usr/lib/python2.5/site-packages/)
    6. Now ardour compiled!
    Doesn't "sed -i 's#SITEPATH=#SITEPATH=:../python2.4/site-packages#' Makefile" just a hack for python version transition and should be removed when the transition is done? I found there are some binary package compiled for python 2.4, while some are compiled for python 2.5. Anyone has suggestion on this?
    Is there any other method to compile ardour from source without recompile python and scons??(or it's just me who got this problem??)
    Thanks in advance.

    no issues at all. been using ardourvst since the old ardour. never had an issue with python.
    I've been running ardour with vst support for 2 years now.
    ardour2.0.2 builds and runs with no issue. I edit the PKGBUILD from extra, interupt the build, add the vst zip package to ../libs/fst and re-run makepkg.
    never ever an issue with python or scons. I'm running the latest of all the the mentioned software with no issues.
    from the ardour website:
    This section applies only to people building Ardour 2.0 (not 0.99.X) and only for Linux/x86 platforms. At this time, you cannot run VST plugins in Ardour on OS X or Linux x86_64 platforms. Note that if you use your x86_64 system in 32 bit mode, that counts as x86, and things will work as expected.
    Please note that it is illegal to build Ardour 2.0 with VST support and then distribute the binary to anyone else. This is because Steinberg continues to refuse to allow redistribution of the otherwise freely available VST SDK. It is therefore not possible for you to comply with the terms of the GPL (i.e. you cannot provide the person you distribute the binary to with all the source code required to build the binary). We hope that one day Steinberg/Yamaha will change the licensing to allow redistribution of the SDK, and then this silly restriction will go away.
    Building Ardour 2.0 with VST support involves a few extra steps before the usual scons-based build.
    1.    Download the VST 2.3 SDK from Steinberg. At this time, we cannot provide you with any advice on where to get this from. Steinberg seems to regularly change the URL required to get the SDK. We recommend that you use google to search for it. Do not download the 2.4 or upcoming 3.0 SDK packages, since Ardour cannot currently use them.
    2.    put the VST SDK zip archive into libs/fst
    3.    make sure you have the Wine "development" package installed (typically called "wine-devel")
    4.    run scons VST=1
    After a successful build, run scons install.
    Running it
    The command name for this version of Ardour is ardourvst, not ardour2 which is the non-VST supporting version. In all other ways, it should behave identically.
    Where to install VST plugins
    Ardour looks for VST plugins in the location(s) indicated by your environment variable
    Last edited by funkmuscle (2007-05-24 13:10:46)

  • Ways to run a shell script that starts a python script

    I have a shell script that is used to launch a python (2.5.1 installed via Fink) script (IDLE). The shell script, the IDLE script, and the python binary are all in /sw/bin as usual. This all has to be done AFTER X11 has been launched. I have to make this easy for my students to use.
    In each account's home .xinitrc file, I have the lines
    source .profile
    vpython2.5 *
    and this works, but it calls the vpython2.5 script every time X11 is launched. I've tried adding the vpython2.5 command to the X11 Applications menu, but this works ONLY if I add /sw/bin to the script name. Apparently the menu doesn't "know" about the current PATH setting. The keyboard shortcut I put in the menu neither shows up nor works either. So much for that option.
    Now I've discovered Platypus and it looked promising, but I'm obiously not using it correctly and from the documentation, I can't figure out what I'm doing wrong.
    So here's the ultimate question. Is there a way to use Platypus to encapsulate the vpython2.5 script, preferably also starting up X11, so students will only have to click on the new app's icon? This is how OpenOffice.org starts up. It seemed simple enough to do in Platypus, but I never saw the IDLE window open up.

    I added a shortcut key "j" for the "xman" app in X11, and it seems to work fine. Did you press the command key with the shortcut key? Are you sure the shortcut key you selected does not overlap with others in the menubar?
    There should be no problems creating an application with Platypus using a shell script. In my experience, you have to source all necessary files, assuming that the shell script does not recognize your terminal settings. You can also launch X11.app in the shell script with the following command:
    command open -a X11
    It is a good idea to pause the shell script until X11 finishes launching. To do this, you need a command like,
    command sleep 5
    Otherwise, if you try to start X11-dependent apps in the shell script while X11 is launching, it will fail. There may be better ways to do this.
    Hope this helps.

  • GTalk from behind the firewall using Python

    Friends,
    I'm a student accessing the net from behind the University Firewall and it does not allow us access to GTalk (some crappy policy). When I was using Windows, about a couple of months back, I used to run Python server and to tunnel thru it to access Internet and GTalk in particular.
    Now Google does not have a dedicated GTalk client, . I tried fiddeling with some settings in iChat and Adium but couldn't get it to work.
    Can anyone help in this respect.
    highly hopeful,
    Aditya
    Macbook   Mac OS X (10.4.8)   2.0Ghz Intel Core 2 Duo, 1Gb ram, 80Gb HD

    Hi,
    This forum may be of more help
    http://discussions.apple.com/forum.jspa?forumID=755
    5:11 PM Sunday; February 25, 2007

  • Python API files

    Hi,
    These (generated?) files are instrumental in library function names autocompletion or calltips or some such things. Some genius invented a killer name for them (pun intended). This API acronym virtually disables Google. I'd be most grateful for some relevant links. Expanded API acronym is welcome, too.
    Last edited by Llama (2013-05-17 15:02:50)

    Llama wrote:Editor settings of the Eric Python IDE comprise the API tab. There is a "Compile APIs Automatically" check box, a choice of programming languages (combo box), and an (empty) list of presumably 'compiled' APIs. There are also cryptic boxes like 'Add from Installed APIs' and 'Add from Plugin APIs'. That's all I have to go on. I've got an impression that it is a Python feature, not Eric's.
    What is your question? Please use a question mark!

  • Python Conneciton to Oracle DB

    Hello.
    Is there a way to connect to an oracle database without installing a separate oracle client and
    without making special client settings?
    A few postings below, somebody posted that there is a way to copy only some files from the oracle client
    to make the connection work (for example via cx_Oracle)
    Does anybody know?

    Hi I am new to this python and Oracle. I am also encountering the same error.
    I wish to connect to a database located on another machine using python from my machine. I dont have Oracle installed on my system but it is there on that remote machine.
    I am also encountering the same error.
    Right now I am using Oracle SQLdeveloper to connect to that database . But I wish to do the same using a python script.
    Can you please help me with this error .
    I have :-
    sqldeveloper-2.1.1.64.45
    python :- 2.6.5
    Thanks,
    Shantanu
    Error which I encounter :-
    import cx_Oracle
    Traceback (most recent call last):
    File "<pyshell#1>", line 1, in <module>
    import cx_Oracle
    ImportError: DLL load failed: The specified procedure could not be found.

  • Trouble with Cocoa-Python Application

    Alright, this may be a completely stupid question but I haven't been able to find the answer anywhere.
    I'm new to developing for OS X and didn't want to get my feet wet with Objective-C yet so I decided to try to make a simple application using the Cocoa-Python method. I got everything working on my computer but when I sent it to a friend to have him test it, he said the app wouldn't open. I figured this might be because he doesn't have the Python framework installed, but I'm not sure.
    Is there a way to somehow bundle the framework within the app itself and have the app use the bundled framework rather than go searching in /Library/Framework/... for the Python.framework?
    I've found similar solutions but none seem to fit what I need.
    Thank you in advance!

    There are two common cases where an application you built doesn't run on another person's Mac. The first case involves the Debug build configuration. Xcode projects built with the Debug build configuration do not create universal binaries. If you have an Intel Mac, build with the Debug build configuration, and give your app to someone with a PowerPC Mac, the app won't run. The fix is to use the Release build configuration, which you should be able to change from the project window toolbar. The Release build configuration builds universal binaries.
    The second case involves people running older versions of Mac OS X. Xcode projects set their deployment target, the earliest version of Mac OS X that can run the app, to the version you're running. If you're running Leopard and give your app to someone running Tiger, the app won't run. The fix is to set the deployment target to 10.4. Choose Project > Edit Project Settings to see your project's build settings. The Deployment Target build setting is in the Deployment collection.

  • Conky - update notifier in python

    Hello there,
    I make update notifier for conky and I hope that it will be useful for someone. Code may be bad, but it works
    Installation:
    1. insert into conky something like this ${texeci 10800 python path/to/python/script}
    2. into cron insert (e.g. /etc/cron.hourly/) shell script
    pacman -Sy
    3. insert somewhere this python script (e.g. /home/user/notify.py)
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    # Description: Python script for notifying archlinux updates.
    # Usage: Put shell script with command 'pacman -Sy' into /etc/cron.hourly/
    # Conky: e.g. put in conky '${texeci 1800 python path/to/this/file}'
    # Author: Michal Orlik <[email protected]>, sabooky <[email protected]>
    # SETTINGS - main settings
    # set this to True if you just want one summary line (True/False)
    brief = False
    # number of packages to display (0 = display all)
    num_of_pkgs = 5
    #show only important packages
    onlyImportant = False
    # OPTIONAL SETTINGS
    # PACKAGE RATING - prioritize packages by rating
    # pkgs will be sorted by rating. pkg rating = ratePkg + rateRepo for that pkg
    # pkg (default=0, wildcards accepted)
    ratePkg = {
    'kernel*':10,
    'pacman':9,
    'nvidia*':8,
    # repo (default=0, wildcards accepted)
    rateRepo = {
    'core':5,
    'extra':4,
    'community':3,
    'testing':2,
    'unstable':1,
    # at what point is a pkg considered "important"
    iThresh = 5
    # OUTPUT SETINGS - configure the output format
    # change width of output
    width = 52
    # if you would use horizontal you possibly want to disable 'block'
    horizontally = False
    # separator of horizontal layout
    separator = ' ---'
    # pkg template - this is how individual pkg info is displayed ('' = disabled)
    # valid keywords - %(name)s, %(repo)s, %(size).2f, %(ver)s, %(rate)s
    pkgTemplate = " %(repo)s/%(name)s %(ver)s"
    # important pkg tempalte - same as above but for "important" pkgs
    ipkgTemplate = " *!* %(repo)s/%(name)s %(ver)s"
    # summary template - this is the summary line at the end
    # valid keywords - %(numpkg)d, %(size).2f, %(inumpkg), %(isize).2f, %(pkgstring)s
    summaryTemplate = " %(numpkg)d %(pkgstring)s"
    # important summary template - same as above if "important" pkgs are found
    isummaryTemplate = summaryTemplate + " (%(inumpkg)d important %(isize).2f MB)"
    # pkg right column template - individual pkg right column
    # valid keywords - same as pkgTemplate
    pkgrightcolTemplate = "%(size).2f MB"
    # important pkg right column template - same as above but for important pkgs
    ipkgrightcolTemplate = pkgrightcolTemplate
    # summary right column template - summay line right column
    # valid keywords - same as summaryTemplate
    summaryrightcolTemplate = "%(size).2f MB"
    # important summary right column template - same as above if "important" pkgs are found
    isummaryrightcolTemplate = summaryrightcolTemplate
    # seperator before summary ('' = disabled)
    block = '-' * 12
    # up to date msg
    u2d = ' Your system is up-to-date'
    import subprocess
    import re
    from time import sleep
    from glob import glob
    from fnmatch import fnmatch
    program = []
    pkgs = []
    url = None
    def runpacman():
    """runs pacman returning the popen object"""
    p = subprocess.Popen(['pacman','-Qu'],
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    return p
    def cmpPkgs(x, y):
    """Compares packages for sorting"""
    if x['rate']==y['rate']:
    return cmp(x['size'], y['size'])
    else:
    return x['rate']-y['rate']
    if onlyImportant:
    pkgTemplate, pkgrightcolTemplate = '',''
    p = runpacman()
    #parse pacmans output
    for line in p.stdout:
    if re.match('(Cíle|Pakete|Targets|Se procesará|Cibles|Pacchetti|'
    'Celuje|Pacotes|Цели):', line):
    program = line.split()[1:]
    for line in p.stdout:
    if not line.strip():
    break
    program += line.split()
    for item in program:
    pkg = {}
    desc_path = False
    desc_paths = glob('/var/lib/pacman/sync/*/%s'%item)
    if not desc_path:
    desc_path = desc_paths[0] + '/desc'
    pkg['repo'] = desc_path.split('/')[-3]
    desc = open(desc_path).readlines()
    checkName = 0
    checkSize = 0
    checkVersion = 0
    for index, line in enumerate(desc):
    if line=='%NAME%\n' and checkName == 0:
    pkgName = desc[index+1].strip()
    pkg['name'] = pkgName
    checkName = 1
    if line=='%CSIZE%\n' and checkSize == 0:
    pkgSize = int(desc[index+1].strip())
    pkg['size'] = pkgSize / 1024.0 / 1024
    checkSize = 1
    if line=='%VERSION%\n' and checkVersion == 0:
    pkgVersion = desc[index+1].strip()
    pkg['ver'] = pkgVersion
    checkVersion = 1
    pkgRate = [v for x, v in ratePkg.iteritems()
    if fnmatch(pkg['name'], x)]
    repoRate = [v for x, v in rateRepo.iteritems()
    if fnmatch(pkg['repo'], x)]
    pkg['rate'] = sum(pkgRate + repoRate)
    pkgs.append(pkg)
    # echo list of pkgs
    if pkgs:
    summary = {}
    summary['numpkg'] = len(pkgs)
    summary['size'] = sum([x['size'] for x in pkgs])
    if summary['numpkg'] == 1:
    summary['pkgstring'] = 'package'
    else:
    summary['pkgstring'] = 'packages'
    summary['inumpkg'] = 0
    summary['isize'] = 0
    lines = []
    pkgs.sort(cmpPkgs, reverse=True)
    for pkg in pkgs:
    important = False
    if pkg['rate'] >= iThresh:
    summary['isize'] += pkg['size']
    summary['inumpkg'] += 1
    pkgString = ipkgTemplate % pkg
    sizeValueString = ipkgrightcolTemplate % pkg
    else:
    pkgString = pkgTemplate % pkg
    sizeValueString = pkgrightcolTemplate % pkg
    if len(pkgString)+len(sizeValueString)>width-1:
    pkgString = pkgString[:width-len(sizeValueString)-4]+'...'
    line = pkgString.ljust(width - len(sizeValueString)) + sizeValueString
    if line.strip():
    lines.append(line)
    if not horizontally:
    separator = '\n'
    if not brief:
    if num_of_pkgs:
    print separator.join(lines[:num_of_pkgs])
    else:
    print separator.join(lines)
    if block:
    print block.rjust(width)
    if summary['inumpkg']:
    overallString = isummaryTemplate % summary
    overallMBString = summaryrightcolTemplate % summary
    else:
    overallString = summaryTemplate % summary
    overallMBString = isummaryrightcolTemplate % summary
    summaryline = overallString.ljust(width - len(overallMBString)) \
    + overallMBString
    if summaryline and not horizontally:
    print summaryline
    else:
    print u2d
    4. make python script executable (chmod +x notify.py)
    5. enjoy!
    And there is how it looks:
    If you have some ideas for improving the program, I will be glad to know it
    Is there someone, who knows how to handle with colors in conky with "exec"?
    UPDATED
    - thanks to sabooky for his idea (package info from disk)
    - important package setting and showing with '*!*' prefix
    - number of printed packages
    - summary line
    - horizontal output
    Last edited by Majkhii (2008-06-07 21:55:33)

    Ok, I think the script is working now. Since I used my local copy to fix the script I'll list the changes. These are changes I've made every now and then, I apologize for not posting some of these changes earlier.
    Changes:
    - 'pacman -Sup' changed to 'pacman -Qu'
       - This takes out the need for checking lck files, the whole sleep/try again code is gone now
       - Even when pacman -Sup was runnable as user it created a system wide lock on the pacman db, the change to root is a good thing IMO.
    - changed '/var/lib/pacman/' to '/var/lib/pacman/sync' (also means this will no longer work with the older pacman, will implement backwards compatibility if requested)
    - Added show "onlyImportant" option (Never actually used this, might be buggy)
    - ipkgTemplate no longer dependent on pkgTemplate.
    - packages with equal 'rating' are sorted based on 'size'
    - if package name is wider then width, it is cropped and followed with a '...'
    Customization differences:
    - Width = 52 (instead of 47)
    To do:
    - I'd like to break the script down into functions to make maintainability easier.
    - If anyone has any feature requests post it here or email me.
    EDIT:
    - changed "Targets:" to do a regex search for all the languages.
      - except for hu.po, can't figure out how to extract that, if anyone knows please tell me. I get "Clok:"
    conkypac.py:
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    # Description: Python script for notifying archlinux updates.
    # Usage: Put shell script with command 'pacman -Sy' into /etc/cron.hourly/
    # Conky: e.g. put in conky '${texeci 1800 python path/to/this/file}'
    # Author: Michal Orlik <[email protected]>, sabooky <[email protected]>
    # SETTINGS - main settings
    # set this to True if you just want one summary line (True/False)
    brief = False
    # number of packages to display (0 = display all)
    num_of_pkgs = 5
    #show only important packages
    onlyImportant = False
    # OPTIONAL SETTINGS
    # PACKAGE RATING - prioritize packages by rating
    # pkgs will be sorted by rating. pkg rating = ratePkg + rateRepo for that pkg
    # pkg (default=0, wildcards accepted)
    ratePkg = {
    'kernel*':10,
    'pacman':9,
    'nvidia*':8,
    # repo (default=0, wildcards accepted)
    rateRepo = {
    'core':5,
    'extra':4,
    'community':3,
    'testing':2,
    'unstable':1,
    # at what point is a pkg considered "important"
    iThresh = 5
    # OUTPUT SETINGS - configure the output format
    # change width of output
    width = 52
    # pkg template - this is how individual pkg info is displayed ('' = disabled)
    # valid keywords - %(name)s, %(repo)s, %(size).2f, %(ver)s, %(rate)s
    pkgTemplate = " %(repo)s/%(name)s %(ver)s"
    # important pkg tempalte - same as above but for "important" pkgs
    ipkgTemplate = " *!* %(repo)s/%(name)s %(ver)s"
    # summary template - this is the summary line at the end
    # valid keywords - %(numpkg)d, %(size).2f, %(inumpkg), %(isize).2f, %(pkgstring)s
    summaryTemplate = " %(numpkg)d %(pkgstring)s"
    # important summary template - same as above if "important" pkgs are found
    isummaryTemplate = summaryTemplate + " (%(inumpkg)d important %(isize).2f MB)"
    # pkg right column template - individual pkg right column
    # valid keywords - same as pkgTemplate
    pkgrightcolTemplate = "%(size).2f MB"
    # important pkg right column template - same as above but for important pkgs
    ipkgrightcolTemplate = pkgrightcolTemplate
    # summary right column template - summay line right column
    # valid keywords - same as summaryTemplate
    summaryrightcolTemplate = "%(size).2f MB"
    # important summary right column template - same as above if "important" pkgs are found
    isummaryrightcolTemplate = summaryrightcolTemplate
    # seperator before summary ('' = disabled)
    block = '-' * 12
    # up to date msg
    u2d = ' Your system is up-to-date'
    import subprocess
    import re
    from time import sleep
    from glob import glob
    from fnmatch import fnmatch
    program = []
    pkgs = []
    url = None
    def runpacman():
    """runs pacman returning the popen object"""
    p = subprocess.Popen(['pacman','-Qu'],
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    return p
    def cmpPkgs(x, y):
    """Compares packages for sorting"""
    if x['rate']==y['rate']:
    return cmp(x['size'], y['size'])
    else:
    return x['rate']-y['rate']
    if onlyImportant:
    pkgTemplate, pkgrightcolTemplate = '',''
    p = runpacman()
    #parse pacmans output
    for line in p.stdout:
    if re.match('(Cíle|Pakete|Targets|Se procesará|Cibles|Pacchetti|'
    'Celuje|Pacotes|Цели):', line):
    program = line.split()[1:]
    for line in p.stdout:
    if not line.strip():
    break
    program += line.split()
    for item in program:
    pkg = {}
    desc_path = False
    desc_paths = glob('/var/lib/pacman/sync/*/%s'%item)
    if not desc_path:
    desc_path = desc_paths[0] + '/desc'
    pkg['repo'] = desc_path.split('/')[-3]
    desc = open(desc_path).readlines()
    checkName = 0
    checkSize = 0
    checkVersion = 0
    for index, line in enumerate(desc):
    if line=='%NAME%\n' and checkName == 0:
    pkgName = desc[index+1].strip()
    pkg['name'] = pkgName
    checkName = 1
    if line=='%CSIZE%\n' and checkSize == 0:
    pkgSize = int(desc[index+1].strip())
    pkg['size'] = pkgSize / 1024.0 / 1024
    checkSize = 1
    if line=='%VERSION%\n' and checkVersion == 0:
    pkgVersion = desc[index+1].strip()
    pkg['ver'] = pkgVersion
    checkVersion = 1
    pkgRate = [v for x, v in ratePkg.iteritems()
    if fnmatch(pkg['name'], x)]
    repoRate = [v for x, v in rateRepo.iteritems()
    if fnmatch(pkg['repo'], x)]
    pkg['rate'] = sum(pkgRate + repoRate)
    pkgs.append(pkg)
    # echo list of pkgs
    if pkgs:
    summary = {}
    summary['numpkg'] = len(pkgs)
    summary['size'] = sum([x['size'] for x in pkgs])
    if summary['numpkg'] == 1:
    summary['pkgstring'] = 'package'
    else:
    summary['pkgstring'] = 'packages'
    summary['inumpkg'] = 0
    summary['isize'] = 0
    lines = []
    pkgs.sort(cmpPkgs, reverse=True)
    for pkg in pkgs:
    important = False
    if pkg['rate'] >= iThresh:
    summary['isize'] += pkg['size']
    summary['inumpkg'] += 1
    pkgString = ipkgTemplate % pkg
    sizeValueString = ipkgrightcolTemplate % pkg
    else:
    pkgString = pkgTemplate % pkg
    sizeValueString = pkgrightcolTemplate % pkg
    if len(pkgString)+len(sizeValueString)>width-1:
    pkgString = pkgString[:width-len(sizeValueString)-4]+'...'
    line = pkgString.ljust(width - len(sizeValueString)) + sizeValueString
    if line.strip():
    lines.append(line)
    if not brief:
    if num_of_pkgs:
    print '\n'.join(lines[:num_of_pkgs])
    else:
    print '\n'.join(lines)
    if block:
    print block.rjust(width)
    if summary['inumpkg']:
    overallString = isummaryTemplate % summary
    overallMBString = summaryrightcolTemplate % summary
    else:
    overallString = summaryTemplate % summary
    overallMBString = isummaryrightcolTemplate % summary
    summaryline = overallString.ljust(width - len(overallMBString)) \
    + overallMBString
    if summaryline:
    print summaryline
    else:
    print u2d
    Last edited by sabooky (2008-01-16 16:41:25)

  • Error starting the GNOME Settings Daemon

    After a full system upgrade of about 500mb, I now get this error when Gnome is started. Also, im kinda new to this...
    "There was an error starting the GNOME Settings Daemon.
    Some things, such as themes, sounds, or background settings may not work correctly.
    The last error message was:
    The name org.gnome.SettingsDaemon was not provided by any .service files
    GNOME will still try to restart the Settings Daemon next time you log in."
    The things is, my background and other desktop stuff is still in their place. But my keyboard has gone back to its default setting and the drivers for my wireless isnt getting loaded. I also have problems playing music with Amarok.
    After the full upgrade of my system I installed compiz-fusion and AWM, but they arent started when i boot. Could they be a problem?
    I looked at some issues with similar error messages, where they downgraded the gnome-settings-tools, how do I do that?

    Hi there!
    I copied the from where pacman generates the fallback version before starting to upgrade.
    [2008-05-30 18:44] :: Begin build
    [2008-05-30 18:44] :: Parsing hook [base]
    [2008-05-30 18:44] :: Parsing hook [udev]
    [2008-05-30 18:44] :: Parsing hook [autodetect]
    [2008-05-30 18:44] :: Parsing hook [pata]
    [2008-05-30 18:44] :: Parsing hook [scsi]
    [2008-05-30 18:44] :: Parsing hook [sata]
    [2008-05-30 18:44] :: Parsing hook [usbinput]
    [2008-05-30 18:44] :: Parsing hook [keymap]
    [2008-05-30 18:44] :: Parsing hook [filesystems]
    [2008-05-30 18:44] :: Generating module dependencies
    [2008-05-30 18:44] :: Generating image '/boot/kernel26.img'...SUCCESS
    [2008-05-30 18:44] ==> SUCCESS
    [2008-05-30 18:44] ==> Building image "fallback"
    [2008-05-30 18:44] ==> Running command: /sbin/mkinitcpio -k 2.6.25-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26-fallback.img -S autodetect
    [2008-05-30 18:44] :: Begin build
    [2008-05-30 18:44] :: Parsing hook [base]
    [2008-05-30 18:44] :: Parsing hook [udev]
    [2008-05-30 18:44] :: Parsing hook [pata]
    [2008-05-30 18:44] :: Parsing hook [scsi]
    [2008-05-30 18:44] :: Parsing hook [sata]
    [2008-05-30 18:44] :: Parsing hook [usbinput]
    [2008-05-30 18:44] :: Parsing hook [keymap]
    [2008-05-30 18:44] :: Parsing hook [filesystems]
    [2008-05-30 18:44] :: Generating module dependencies
    [2008-05-30 18:44] :: Generating image '/boot/kernel26-fallback.img'...SUCCESS
    [2008-05-30 18:44] ==> SUCCESS
    [2008-05-30 18:44] upgraded kernel26 (2.6.24.1-2 -> 2.6.25.4-1)
    [2008-05-30 18:44] upgraded ipw3945 (1.2.2-7 -> 1.2.2-10)
    [2008-05-30 18:44] upgraded libdvdnav (0.1.10-2 -> 0.1.10-3)
    [2008-05-30 18:44] upgraded libebml (0.7.7-1 -> 0.7.8-1)
    [2008-05-30 18:44] upgraded libgail-gnome (1.20.0-1 -> 1.20.0-2)
    [2008-05-30 18:44] upgraded libnetworkmanager (0.6.5-1 -> 0.6.6-1)
    [2008-05-30 18:44] upgraded libnl (1.0pre6-1 -> 1.1-1)
    [2008-05-30 18:44] upgraded libsamplerate (0.1.2-4 -> 0.1.3-1)
    [2008-05-30 18:44] upgraded licenses (2.3-1 -> 2.4-1)
    [2008-05-30 18:44] upgraded lvm2 (2.02.33-1 -> 2.02.36-1)
    [2008-05-30 18:44] upgraded man-pages (2.77-1 -> 2.79-1)
    [2008-05-30 18:45] Updating font cache... done.
    [2008-05-30 18:45] upgraded ttf-dejavu (2.23-1 -> 2.25-1)
    [2008-05-30 18:45] upgraded mplayer (1.0rc2-2.1 -> 1.0rc2-3)
    [2008-05-30 18:45] upgraded nautilus-cd-burner (2.20.0-1 -> 2.22.1-1)
    [2008-05-30 18:45] upgraded networkmanager (0.6.5-3 -> 0.6.6-1)
    [2008-05-30 18:45] In order to use the new nvidia module, exit Xserver and unload it manually.
    [2008-05-30 18:45] upgraded nvidia (169.09-2 -> 169.12-4)
    [2008-05-30 18:45] upgraded opera (9.25-2 -> 9.27-1)
    [2008-05-30 18:45] upgraded orca (2.20.3-1 -> 2.22.0-1)
    [2008-05-30 18:45] upgraded pcmciautils (014-3 -> 014-4)
    [2008-05-30 18:45] upgraded perlxml (2.34-4 -> 2.36-1)
    [2008-05-30 18:45] upgraded perl-xml-simple (2.18-1 -> 2.18-2)
    [2008-05-30 18:45] upgraded printproto (1.0.3-1 -> 1.0.4-1)
    [2008-05-30 18:45] upgraded pycairo (1.4.0-3 -> 1.4.12-1)
    [2008-05-30 18:45] upgraded qt (4.3.3-4 -> 4.3.4-1)
    [2008-05-30 18:46] upgraded seahorse (2.20.3-1 -> 2.22.1-1)
    [2008-05-30 18:46] upgraded sound-juicer (2.20.1-1 -> 2.22.0-1)
    [2008-05-30 18:46] upgraded tar (1.19-2 -> 1.20-2)
    [2008-05-30 18:46] installed ndesk-dbus (0.6.0-1)
    [2008-05-30 18:46] installed ndesk-dbus-glib (0.4.1-1)
    [2008-05-30 18:46] installed mono-addins (0.3.1-2)
    [2008-05-30 18:46] upgraded tomboy (0.8.1-1 -> 0.10.1-1)
    [2008-05-30 18:46] upgraded totem-plparser (2.21.91-1 -> 2.22.2-1)
    [2008-05-30 18:46] installed libepc (0.3.5-1)
    [2008-05-30 18:46] installed python-elementtree (1.2.6-2)
    [2008-05-30 18:46] installed python-gdata (1.0.11.1-1)
    [2008-05-30 18:46]
    [2008-05-30 18:46] ==> Totem has been built with GStreamer. By default, only plugins from
    [2008-05-30 18:46] ==> gst-plugins-good and gst-plugins-base are installed.
    [2008-05-30 18:46] ==>
    [2008-05-30 18:46] ==> To play additional media formats, more plugins are available from
    [2008-05-30 18:46] ==> gstreamer0.10-ugly-plugins, gstreamer0.10-bad-plugins
    [2008-05-30 18:46] ==> and gstreamer0.10-ffmpeg packages.
    [2008-05-30 18:46] ==>
    [2008-05-30 18:46] ==> There's also a xine build of Totem available, install totem-xine instead
    [2008-05-30 18:46] ==> of this package if you want xine to play your media files.
    [2008-05-30 18:46]
    [2008-05-30 18:46] upgraded totem (2.20.1-3 -> 2.22.2-1)
    [2008-05-30 18:46] upgraded totem-plugin (2.20.1-3 -> 2.22.0-1)
    [2008-05-30 18:46] Remove vi related symlinks ...
    [2008-05-30 18:46] Create vi related symlinks...
    [2008-05-30 18:46] Updating vi help tags...done.
    [2008-05-30 18:46] upgraded vi (7.1.228-1 -> 7.1.267-1)
    [2008-05-30 18:46] upgraded vino (2.20.1-1 -> 2.22.1-1)
    [2008-05-30 18:46] upgraded vlc (0.8.6d-2 -> 0.8.6f-3)
    [2008-05-30 18:46] upgraded wget (1.11-1 -> 1.11.2-1)
    [2008-05-30 18:47] upgraded xfsprogs (2.9.4-2 -> 2.9.7-1)
    [2008-05-30 18:47] upgraded xorg-apps (1.0.3-2 -> 1.0.3-3)
    [2008-05-30 18:47] upgraded xproto (7.0.11-1 -> 7.0.12-1)
    [2008-05-30 18:47] upgraded xtrans (1.0.4-1 -> 1.2-1)
    [2008-05-30 18:47] upgraded zenity (2.20.1-1 -> 2.22.1-1)
    Last edited by derelic (2008-05-31 16:17:58)

  • Python tool for keeping track of strings

    I wrote this just now. It associates keys to strings; basically a centralized means of storing values.
    #!/usr/bin/env python
    from cPickle import load, dump
    from sys import argv
    from os.path import expanduser
    strings_file = expanduser('~/lib/cfg-strings')
    try:
    with open(strings_file) as f:
    strings = load(f)
    except:
    strings = {}
    if len(argv) < 2:
    print('''usage:
    {0} dump
    {0} get <key>
    {0} del <key>
    {0} set <key> <val>'''.format(argv[0]))
    elif len(argv) == 2:
    if argv[1] == 'dump':
    for k in strings.keys(): print(k + ': ' + strings[k])
    elif len(argv) == 3:
    if argv[1] == 'get':
    if argv[2] in strings.keys():
    print(strings[argv[2]])
    elif argv[1] == 'del':
    if argv[2] in strings.keys():
    del(strings[argv[2]])
    elif len(argv) == 4:
    if argv[1] == 'set':
    strings[argv[2]] = argv[3]
    with open(strings_file, 'w') as f:
    dump(strings, f)
    Replace '~/lib/cfg-strings' with your preferred destination for the pickle file.
    As an example, I have this at the end of my .xinitrc:
    exec $(cfg get wm)
    so all I have to do is type "cfg set wm ..." to change my window manager. Note that on my system, the script is named 'cfg', so you'll want to change that depending on what you call it.
    To be honest, though, I think everyone has written something like this at least once.
    Last edited by Peasantoid (2010-01-18 01:29:14)

    Nice idea Peasantoid! I have wanted something similar for myself for a while now however wasn't exactly sure how best to do this. Here's my version. It is based on yours though as I prefer plain text for the settings file so I used JSON.
    #!/usr/bin/python
    import json
    import os.path
    import sys
    SETTINGS_FILE = os.path.expanduser('~/configs/settings.json')
    def dump(s):
    print json.dumps(s, sort_keys = True, indent=2)
    def get(s, key):
    if s.has_key(key):
    print s[key]
    def set(s, key, val):
    s[key] = val
    save(s)
    def delete(s, key):
    if s.has_key(key):
    del s[key]
    save(s)
    def save(s):
    json.dump(s, open(SETTINGS_FILE, 'w'))
    def usage():
    str = [
    "usage: %s dump (default)",
    " %s get <key>",
    " %s set <key> <val>",
    " %s delete <key>"
    for x in str:
    print x % sys.argv[0]
    def main():
    try:
    settings = json.load(open(SETTINGS_FILE))
    except:
    settings = {}
    a = sys.argv
    n = len(a)
    if n == 1 or (n == 2 and a[1] == 'dump'):
    dump(settings)
    elif n == 3 and a[1] == 'get':
    get(settings, a[2])
    elif n == 3 and a[1] == 'delete':
    delete(settings, a[2])
    elif n == 4 and a[1] == 'set':
    set(settings, a[2], a[3])
    else:
    usage()
    if __name__ == "__main__":
    main()

  • Python: no module named struct

    Ever since I performed an update (for x86_64, if that makes a difference) this afternoon, beryl-settings has failed to start for me. It always fails with this message:
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    Traceback (most recent call last):
      File "/usr/bin/beryl-settings", line 12, in ?
        import gettext
      File "/usr/lib/python2.4/gettext.py", line 49, in ?
        import locale, copy, os, re, struct, sys
    ImportError: No module named struct
    /usr/lib/python2.4/gettext.py belongs to the python package, so I'm supposing the breakage has something to do with that? Pacman says that I currently have python-2.4.4-1.1 installed.

    When I try to run beryl-manager the next error occurs.
    Could not find platform independent libraries <prefix>
    Could not find platform dependent libraries <exec_prefix>
    Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
    'import site' failed; use -v for traceback
    Traceback (most recent call last):
    File "/usr/bin/beryl-settings", line 2, in ?
    import berylsettings
    ImportError: No module named berylsettings

  • [solved] Cannot launch cinnamon-settings - missing image module

    Hello,
    When I try to run `cinnamon-settings` it fails with the following message:
    [orschiro@thinkpad ~]$ cinnamon-settings
    No module named Image
    However, I seem to have installed all relevant packages:
    :: python2-imaging and python2-pillow are in conflict (python-imaging). Remove python2-pillow? [y/N] y
    error: failed to prepare transaction (could not satisfy dependencies)
    :: cinnamon: requires python2-pillow
    Any ideas?
    Last edited by orschiro (2013-11-09 07:51:01)

    orschiro wrote:
    Hello,
    When I try to run `cinnamon-settings` it fails with the following message:
    [orschiro@thinkpad ~]$ cinnamon-settings
    No module named Image
    It may be that there is a file missing in /usr/lib/cinnamon-settings/modules, or code missing from one of the files in that folder. I honestly couldn't say because development is going so fast.
    @orschiro: Which versions of the cinnamon and cinnamon-settings-daemon packages do you have installed?
    @Karol: It may be unrelated seeing as pam is a separate package to cinnamon-settings-daemon, but I wouldn't rule it out just yet.

  • Python script in dasylab using single input multiple output

    Hello
    For a project, I would like to use the python scripting module of dasylab 13. I got it to work for simple functions such as y=f(x), where i have one input and one output.
    The next step in order to get to where i want to be with my script is using a single input and generating two outputs.
    I defined it in the "predefined settings" that pops up first. The module created looked as it should, having one input and two outputs. However, when I wanted to edit the script (and double clicked the module) the module went back to having one input and one output.
    I searched the help and found the section "channel assignment constants". There describe the various constants, which should have been set in predefined settings. In my case it is CR_1_2.
    It also states to setup the meta data in the SetupFifo tab.
    Now here is my problem: How should i change the SetupFifo tab?
    I tried the command:
    self.SetChannelRelation(channel_no, Ly.CR_1_2)
    Unfotunately this didn't work, which doesn't supprise me, as I made this command up, based on the examples in the help file on the SetupFifo tab. Those are, however, for SetChannelFlags and SetChannelType, which I don't think I need yet...
    Has anyone experienced a similar problem? I also installed a trial version on another computer to check if it works there (it doesn't).
    Or does someone know a method to find out how to be able to change inputs and outputs the way i want?
    Every help will be greatly appreciated.
    Sincerely, Jarno

    You do not need to set the channel relation for "simple" channel relation like 1:2, 2:1, etc.
    Just set the relation you want in the configration dialog that open when you drop a script module into to worksheet.
    The channel relation and their python constants have nothing to do with the amount of inputs and outputs of a script module.
    The channel relation tells the "DASYLab core" how to guide meta data (channel names, units, etc) through a module.
    In function "DlgInit" you have to tell DASYLab how many inputs and outputs your module should have.
    Your module should have 2 outputs for each input: this combination of input and outputs is called a "channel".
    Because one channel has 2 outputs, the module can have max. 8 channels only.
    The dialog with the channelbar "thinks" in  channels, but DASYLab "thinks" in connectors (connectors are inputs/outputs).
    So, you are responsible to translate "channels" in "connectors" and vice versa
    In DlgInit you can ask DASYLab about the amount of inputs and outputs.
    self.NumInChannel <-- amout of connectors on modules left side
    self.NumOutChannel <-- amount of connectors on the right side
    self.DlgNumChannels <-- amount of activated channels in the dialog (something between 1 and DlgMaxChannels)
    Your module's channels have 1 input, 2 outputs each, so you can write either
    self.DlgNumChannels = self.NumOutChannel / 2
    or
    self.DlgNumChannels = self.NumInChannel
    If the module has 3 input and 6 outputs, the dialog will get 3 channels.
    In DlgOk you need to translate the amount of channels into the correct amount of connectors (inputs/outputs):
    For "one channel = 1 input + 2 outputs" this is:
    self.SetConnectors( self.DlgNumChannels, self.DlgNumChannels * 2 )
    DlgInit
    self.DlgNumChannels = self.NumInChannel
    # or: self.DlgNumChannels = self.NumOutChannel / 2
    self.DlgMaxChannels = 8 # or Ly.MAX_CHANNELS/2
    DlgOk
    self.SetConnectors( self.DlgNumChannels, self.DlgNumChannels * 2 )
    M.Sc. Holger Wons | measX GmbH&Co. KG, Mönchengladbach, Germany | DASYLab, DIAdem, LabView --- Support, Projects, Training | Platinum National Instrument Alliance Partner | www.measx.com

Maybe you are looking for

  • Calendar Widget Not Showing Upcoming Events

    I've upgraded to the latest N900 firmware (pr1.2) and ever since I have had a problem with the calendar widget. All the events are contained in the calendar when I open it however they are not displayed on the desktop widget. I've got events loaded f

  • Different labels for a textview based on component usage

    Hi, We are on SAP E-Recruiting EHP5 and we have a requirement wherein the label of a textview in a view needs to be dynamicaly controlled. The candidates personal data page (view VW_PERSONALDATA of component HRRCF_C_PERSONL_DATA_UI) gets displayed bo

  • Apply exakt steps from History log file to another image?

    Alright. If you edit an image and the history log option is turned on, you can look at the exakt steps you've made with all the settings for the individual tools and effects used. Also steps you make can be recorded with the actions tool. My question

  • Thinking about giving up...

    I have many years of experience doing UNIX/Linux (and way back Mac) admin work but Leopard Server has me wanting to quit altogether. It started, as these types of things often do, with the seductive promise of an all in one server with georgous black

  • Picking List Error

    Hi Experts, I have created Script for Picking List, I am getting the below error when processing ... Error Info...   VN 073: Errors occurred while processing output Its working fine when Standard Script SD_PICK_SINGLE is used .. Pls Help. Regards