Page 2 of 4
Re: python path
Posted: 2. Feb 2012, 15:21
by ink3
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:.:/home/stahoo/skrypty_bash/
$ cat ~/.bashrc
export PS1='\u[\W]\$ '
export PAGER="most"
export PATH=$PATH:/home/stahoo/skrypty_bash/
export PATH=$PATH:/home/stahoo/skrypty_python/
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
alias ls='ls --color=auto'stahoo[skrypty_bash]
This bold line ^ is correct?
Re: python path
Posted: 2. Feb 2012, 15:30
by mimosa
That looks right to me, except maybe you don't want those forward slashes at the end. And maybe that's why it's not working now. I notice they appear when you echo your $PATH - but not for any of the other directories in $PATH.
Re: python path
Posted: 2. Feb 2012, 18:05
by ink3
unfortunately does not work
I try change path :
export PYTHONPATH=$PYTHONPATH:/home/stahoo/skrypty_python
$ echo $PYTHONPATH
:/home/stahoo/skrypty_python/
but result is the same
Re: python path
Posted: 2. Feb 2012, 18:57
by mimosa
No, $PATH, not $PYTHONPATH!
Change it in your .bashrc and reboot, I'd suggest. Leave everything just as it is but remove those slashes. I'm just guessing that that's the problem, but it seems worth a try.
EDIT
Also, maybe you should use $HOME rather than an explicit path. Here is my ~/.profile:
... but again maybe that's not what's causing your problem.
Re: python path
Posted: 2. Feb 2012, 19:17
by ink3
ok, bashrc:
export PATH=$PATH:/home/stahoo/skrypty_python
reboot
echo $PATH
...........:/home/stahoo/skrypty_python
$ python losuj.py
python: can't open file 'losuj.py': [Errno 2] No such file or directory
$ losuj.py
bash: /home/stahoo/skrypty_python/losuj.py: Permission denied
hmm?
$ ls -la losuj.py
-rwxr-xr-x 1 stahoo stahoo 74 Feb 2 11:53 losuj.py
Re: python path
Posted: 2. Feb 2012, 19:21
by mimosa
Code: Select all
$cd ~/skrypty_python
$./losuj.py
$ls -l losuj.py
Re: python path
Posted: 2. Feb 2012, 19:27
by ink3
./losuj.py
bash: ./losuj.py: Permission denied
ls -l losuj.py
-rwxr-xr-x 1 stahoo stahoo 74 Feb 2 11:53 losuj.py
Re: python path
Posted: 2. Feb 2012, 19:58
by mimosa
I'm afraid I'm stumped - you own the file and it has execute permissions. Maybe something to do with the script itself? What about the shell script - does that work now?
Re: python path
Posted: 2. Feb 2012, 22:21
by Shador
ink3 wrote:
$ losuj.py
bash: /home/stahoo/skrypty_python/losuj.py: Permission denied
Could it be your shebang (#!) is wrong?

This caused me an unwanted but at least clean shutdown of a machine at work during a power failure today.
For python it should be something like this:
Re: python path
Posted: 3. Feb 2012, 06:19
by ink3
I dont't think so.
losuj.py and losuj-1.py are the same scripts but have different first line.
#!/usr/bin/env python
import random
random.seed()
s=random.randint(1,595)
print s
^ losuj-1.py ; losuj.py has
#!/usr/bin/python