i have started using python for using modeller software for modelling proteins. i have a plot script for plotting graphs it has a module named pylab and its not working with the modeller CMD prompt with windows7 software. and while running the same script by using python shell it showing importerror no module nemed modeller. when i asked to my higher officials he asked me to set PYTHONPATH and LD_LIBRARY_PATH variables. but i dont know how to do it..can u explain me how to set the path in layman format which i can understand easily. but then too i have tried Advanced setting->environmental variables and setting variables but i do not know how to set the path for each variables..please some one guide me with it.
There is some documentation in the python docs for how to deal with this, but it sounds like the confusion is on what to set the variable to.
If you start your command prompt (cmd.exe in the start menu), you can set a variable by using the command
SET PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
The PYTHONPATH variable describes the location of the modules so python knows where to look to find them. It looks like a list of filepaths separated by semicolons.
What this command does is set the variable PYTHONPATH to its current value (the %PYTHONPATH part), adds a semicolon, and puts C:\My_python_lib at the end of the list.
You need to find the path to the pylab module (probably a folder named "pylab" with a file called __init__.py in it) and add it's location to your PYTHONPATH
Related
I know WiX Toolset have some built-in variables that you can use on your projects. A list of them can be consulted here.
But how can I know the value of a variable? For example, if I want to know what value stores LocalAppDataFolder variable, how can I do that from Visual Studio? Is there any command to output its value? I mean something like when outputting system environment variables values from command prompt: echo %Path%
Do you want to know it for your system?
Cause the whole point of these variables is, that they're dependent on the OS installation and you should treat them as variable. In most cases it will point to: %USERPROFILE%\AppData\Local, but since the location of the appdata folder can be controlled during system preparation, it could point to something completely different. Ultimately, this location is retrieved from the Windows Registry:
HKEY_USERS\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Different built-in variables may use different sources to evaluate during installation.
I am automating a process and I use GPG2.exe for it.
Because I need to parse console output - potentially from different systems I need to set the languge to a controlled value.
I am following the Instructions from the manual which states that
LANGUAGE
Apart from its use by GNU, it is used in the W32 version to override the
language selection done through the Registry. If used and set to a valid and
available language name (langid), the file with the translation is loaded from
gpgdir/gnupg.nls/langid.mo. Here gpgdir is the directory out of which the
gpg binary has been loaded. If it can’t be loaded the Registry is tried and as
last resort the native Windows locale system is used.
I found a thread from 2011 that goes into a bit more detail regarding this problem, but this may actaully concern a different version.
I created a batch file for manual testing.
#echo off
REM C is meant to display untranslated messages according to one internet source
set LANGUAGE="C"
call "C:\Program Files (x86)\GNU\GnuPG\gpg2.exe" --version
pause
I ecpext the output to be english but it is still german.
The manual states something about there beegin a "gnupg.nls" folder somewhere.
I was not able to locate this folder, which makes me wonder where german is loaded from.
Is there an error in the man page?
The pdf Version of the man page shows the same content as the man page that came with the installation.
Can someone shed some light on this?
I had the same problem that the output was in Swedish though I wanted it in English. The Windows display language was set to English, and I also tried setting environment variables but what solved it for me was to remove the Swedish translation for gnupg file found here:
C:\Program Files (x86)\gnupg\share\locale
After having removed the "sv" directory all output was in English.
The language directory can be pulled from the registry or I suppose it can also have a fixed path since I can not find the information in my registry.
On my testsysten the path is 'C:\Program Files (x86)\GNU\GnuPG\share\locale'.
This path contains folders for each language - not all of them contain translation files for gpg2 as far as I can tell.
The environment variable for language is not LANGUAGE but LANG. Setting it to C causes gpg2 to default to english.
I successfully tested the following call.
#echo off
set LANG=C
call "C:\Program Files (x86)\GNU\GnuPG\gpg2.exe" --version
User bignose is still correct when he states that I should use the API instead but within my current restrictions I do not see a straight forward way to do so.
This isn't a programming question, as noted in the votes to close.
To answer a different question that could be asked from a programming perspective: Don't parse inherently-changeable console output, when there is a well-defined library API for the same functionality.
Does any one have idea, what if i want to define path with some environment variable in fitnesse setup via content.txt.
At this moment we have content.txt checked in our repository containing the path variable of each and every developers environment. I want to resolve that problem by defining atleast a variable prefix with a standard path.
Current path definitions like below:
!path /home/xyz/workspace/blah/blah
Want to change it to something like
!path $workspace/blah/blah
I tried using !define workspace {this/is/my/path}
but it doesn't seems to be working and complains undefined variable workspace.
Use ${myvariable} to reference a variable.
Mike has pointed out that the way you referring variable is wrong. Here are some more details for those who get confused between ${variable} and $slimSymbol when first started using FitNesse.
${variable} is a concept on the Wiki page level . There are a few ways to define them:
using !define statement
properties in the plugins.properties file
using system variable passed when starting FitNesse Server
through url params
These variable will be translated at the time the page is visited. You can find some official documentation here
$slimSymbol on the other hand is a "runtime variable" used in SLiM test system. They are defined by using $slimSymbol= symtax in the test case, and the value will only be available in the runtime. Documentation here
I am trying to write a batch script where I have hard coded a source path and a target path. I have also made a list of the Software I wish to copy. For example SET list=python perl. I want to know how can I determine whether I already have the latest version of the software. Could I extract that information through environment variables? Thanks in advance for the help.
Edit: My apologies. Yes this is on the Windows OS. Prior to asking this question, I have use the command "set" to see if there is any e-vars that are set automatically that contain the software version, but none of them seem to contain that kind of information. Also, I am using robocopy.
ROBOCOPY %SOURCE_PATH% %TARGET_PATH% /E /Z /COPYALL /SECFIX /R:10 /W:1
How many pieces of software do you have in this list? Each one will have a different way of checking the version - for example; with python you could check the version simply by looking for the directory in your C drive - however that is very unrobust and I would do something like the following:
> getVer.py ( echo import sys & echo print^(sys.version^) )
for /F %%a in ('getVer.py') do set pyver=%%a
del getVer.py
echo %pyver%
That is how I've had to do it as, for some reason, this doesn't work for me (even though I have Python installed).
My method is only good if you're happy to assume that Python IS installed, otherwise you will end up with your script bringing up a dialogue asking what software to open the .py file with.
EDIT: I have learned different ways to check if your programs exist by asking a question here.
AMPL by default uses MINOS. I have to type option solver "./lpsolve"; every time I want to use lpsolve as my solver. Is there a way to change the default?
Create a text file in the directory where AMPL and lpsolve is with the following line:
option solver './lpsolve';
Before running ampl, you have to set the OPTIONS_IN environment variable and make it point to this newly created text file. I am using bash and I gave the name settings.txt to this text file. Before calling ampl, I issue the following command in the bash shell:
export OPTIONS_IN=./settings.txt
There are others ways to do this, and you may use another shell so I don't want to expand on this.
You may find useful the CPLEX user's guide. Even though it's for CPLEX, there are a few sections on ampl that generally apply.
For example all the above I write is in this user's guide, see Chapter 4 Customizing AMPL, section Persistent Option Settings.