Forums

problem with import in bash console

I try in Bash console import my own file odbchelper.py witch is in directory pdf but I have an message

18:45 ~/pdf $ import odbchelperpdf: unable to open X server `' @ error/import.c/ImportImageCommand/368.

other commend

18:39 ~/pdf $ python -c "odbchelper.py"Traceback (most recent call last): File "<string>", line 1, in <module>NameError: name 'odbchelper' is not defined

how can I import odbchelper.py

This is because import is part of python syntax, not bash syntax. So in the first case, you could have run

python -c "import odbchelperpdf"

Or you could switch to a python console and then your code will work fine. You can directly access a python, ipython or pypy console from our consoles tab (all of these would work).

If you would like to enter a python console from within your bash console, try typing just:

python

and you will find that you get to the same python console as before. Then directly from the console's command prompt, you can run

import obdchelperpdf

and it will work.

Thank You for help, now it is work!

greet Darek :)