Append new pythonpath permanently in Geany IDE - pythonpath

How can I add a new pythonpath in Geany? Is something in the preferences/options that I'm missing? I tried adding this in .bashrc , but it didn't work.
export PYTHONPATH=/mypath
What I do now is to add these two lines in the top of every script, but it's not good as a permanent solution:
import sys
sys.path.append('mypath')

Add export PYTHONPATH=$PYTHONPATH:/mypath to /etc/profile and reboot.
That should work for you.

You can also do it without modifying any system configuration.
In Geany go to Edit > Preferences > Tools
Terminal field should say something like:
x-terminal-emulator -e "/bin/sh %c"
Change it to:
x-terminal-emulator -e "env PYTHONPATH=/mypath /bin/sh %c"

Related

SGE analogue of .bashrc?

When I submit a job with qsub to SGE, the job's shell will not read .bashrc. Is there a file analogous to .bashrc that will be read by the shell of all jobs started with qsub?
I know there is a .sge_request file, but it only contains default options for qsub, not a list of commands like .bashrc. What I want is to set some environment variables for my job, like $PATH and $LD_LIBRARY_PATH. I don't think I can do that with .sge_request, but if I can, that would also solve my problem.
This is better accomplished using the -V option to qsub , which imports all environment variables set, including those in .bashrc.
.bashrc can be read if you submit an interactive job, just change the header of your job script to:
#!/bin/bash -i

changing $PATH by editing .bash_profile

I am having some trouble changing my $PATH variable to include my recent mysql install. This is what I did. In a terminal session (using the zsh shell) I typed
nano .bash_profile
Inside of this file I put
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I exit, save, and when I type
cat .bash_profile
I can see the file was edited properly but when I close the terminal session, open a new window, and type
echo $PATH
I get the following:
/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin
So not only is my new mysql path not in there but it didn't change at all. It must be saved in a different file besides .bash_profile correct? Any ideas which one?
Thanks in advance
The correct way to add paths to the environment in OS X is to create entries in /etc/paths.d, so in this case you might put "/usr/local/mysql/bin" into /etc/paths.d/mysql. More info in this question.
You can add:
export PATH="/usr/local/mysql/bin:$PATH"
into your .bash_profile file and you need to RESTART the terminal
or open new tab to check the added path.

Shortcut to MySql on Mac OS X?

I am trying to add a path so I don't have to keep typing usr/local/mysql/bin every time I want to start Mysql. I found instructions here that say:
Edit the file /etc/profile and update the path by adding:
usr/local/mysql/bin/, for example:
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin"
Problems:
1. There is no existing line in my profile file that says 'path'. This is what it currently says in profile:
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval '/usr/libexec/path_helper -s'
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
2. I really have no idea what I'm doing on a mac (yet). What do I add/change to the above file so mysql is easier to access?
It depends on whether or not you want all user accounts to have access to MySQL, or just you.
For everyone, edit /etc/profile as instructed and add the following to the end:
export PATH=$PATH:usr/local/mysql/bin
For just you (ALSO, this is safest so you don't accidentally mess up any system variables!):
Get a terminal session: Launch Terminal if it's not already running.
Make sure you're in your home directory:
CD ~
See if .bash_profile exists:
ls -al .b*
If it does, open it with your favorite text editor. If it doesn't, launch your favorite text editor and Save as... .bash_profile in your home folder.
Add this line to .bash_profile and Save:
export PATH=$PATH:/usr/local/mysql/bin
Then close Terminal and open again for the change to take effect.
Hope this works out for you.

Mac OS X & MAMP - How to run mysql without having to type in the full path?

Right now, if I want to run mysql, I have to do /Applications/MAMP/Library/bin/mysql -u user -ppass... I'd be a happy camper if I could just do mysql -u user -ppass.... Been googling around, but haven't been able to find anything... Have a feeling I'm using dumb search terms, so if anyone here knows how to do this, that'd be awesome...
you can either add /Applications/MAMP/Library/bin/ to your bash PATH variable (edit your .bash_profile, find the line with export PATH=... and add here the path to MAMP bin folder) , or maybe create an alias with alias mysql='/Applications/.../bin/mysql' (also in your .bash_profile).
Add:
export PATH=$PATH:/Applications/MAMP/Library/bin/
to your ~/.profile
It will take effect next time your profile is initialized (I'm not sure when that is under OS X, it might be when you start your terminal application, it might be when you log in)
It depends what shell you're using. You should be able to add /Applications/MAMP/Library/bin/ to your path:
export PATH=${PATH}:/Applications/MAMP/Library/bin
Mac OS uses bash by default. Just add this line to your .bashrc.
Execute . ./.profile to restart your profile.

How to install MySQL on Leopard, Mac OS X 10.5?

I followed this tutorial to the very end, then found out it didn't work right. I think I have everything installed but when I type
mysql -uroot
I only get
-bash: mysql: command not found
Note: I did not skip the "Setting the Path" step. Upon running this command for the first time:
mate ~/.bash_login
This brought up an empty file. So I added this line:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I saved the file, closed TextMate, executed the following command:
. ~/.bash_login
...and continued with the tutorial. Based on your suggestions, I thought maybe the file didn't actually get saved. So I ran the following command to bring up the file again:
mate ~/.bash_login
...yet the contents of the file were as they should be.
Any suggestions?
You probably don't have the mysql binaries in your path.
The link you posted has a section on setting the path, titled "Setting the Path Do not skip this step! Most everything else will fail if you do."
EDIT: As debugging steps, try:
First launching a new terminal window. Does it run now?
Typing "echo $PATH" at the prompt. Does the path show up correctly as you've typed it in bash_profile?
Running it the long way: /usr/local/mysql/bin/mysql -u root
Does the application run?
Did you follow the step that says
Setting the Path
Do not skip this step! Most everything
else will fail if you do.
Did you close your terminal window and re-open it afterwards?
Update:
What does "which mysql" say? Does "ls /usr/local/mysql/bin" say?
Two things:
Try editing ~/.profile (rather than ~/.bash_profile or ~/.bash_login).
You may find it easier to use the native Mac style .dmg installer directly from Sun.
One nice thing about the dmg installer is that it automagically sets up symlinks to /usr/local/mysql (which means less - or no - fiddling with your $PATH).
Another option would be to use MAMP.
It has Apache, PHP and MySQL packaged with no further setup necessary.
MySQL is usually put in /usr/local/mysql/bin/
You need to add this to your PATH, you can do this by adding the follwoing lines to your .bash_profile
PATH=$PATH:/usr/local/mysql/bin/
export PATH
The .bash_profile file is located in the root of your username directory.
Make sure you restart your Terminal for the setting to take affect.
And if you're not a command-line person, I highly recommend you also install the MySQL Preference Pane to start/stop the server and install Sequel Pro to create databases and run queries.
ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip
http://www.sequelpro.com/