python executable
can anyone tell me how do i get to make a bin or .pyc extension file with my python code.i need to make my code executable so that no can see my code.
|
Whenever you import a .py module, python will compile it into a .pyc file.
|
thanks for reply
hi i did the same thing but i get following error i dont whats wrong
python Python 2.4.2 (#1, Feb 12 2006, 03:59:46) [GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import hello.py This is a multi-line string. This is the first line. This is the second line. "What's your name?," I asked. He said "Bond, James Bond." Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: No module named py my script is #!/usr/bin/python #Filename : hello.py print '''This is a multi-line string. This is the first line. This is the second line. "What's your name?," I asked. He said "Bond, James Bond." ''' s='hi this is.\ deep jyot singh.' print \ s number = 45 guess = int(raw_input('Enter an Integer : ')) if guess == number: print 'Congratulations,you guessed it correct.' elif guess < number: print 'you are higher than number' else: print 'your guess is wrong' print 'Done' |
Remove ".py" when importing. Like this:
Code:
import hello Code:
#!/usr/bin/env python |
All times are GMT -5. The time now is 06:45 AM. |