LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-13-2006, 03:25 AM   #1
GiantBucket
LQ Newbie
 
Registered: Jan 2006
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
Python doesn't make pyc files


I am running Slackware 10.2, and for some reason running "python file.py" doesn't make a file.pyc (compiled bytecode) in the same directory. Does anyone have a shot this problem? The version of python is 2.4.1
 
Old 03-13-2006, 05:59 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
That will just run the python script. Take a look here and here for documentation on how to compile python source files.
 
Old 03-13-2006, 06:04 AM   #3
mcgrew
Member
 
Registered: May 2005
Location: West Virginia, US
Distribution: Gentoo
Posts: 56

Rep: Reputation: 21
That's because python doesn't need pyc files to run. If you need one, the simplest way is to simply import the file into a python shell. Change to the directory the file is in and run python. Then enter this.

Code:
from os import getcwd
from sys import path
path.append(getcwd())
import pythonfile.py
Then press Ctrl-D to exit python and you should have a .pyc file in the directory.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
python - make curses play nice w/ os.system() datadriven Programming 0 02-17-2005 04:31 PM
Python headers... How do I make 'em? ljr2600 Linux - Software 1 09-06-2004 10:45 PM
Python and binary files The_Nerd Programming 2 08-27-2004 03:48 PM
How do I make a daemon in python for linux? koppertop Linux - Software 1 08-13-2004 11:43 AM
make compile errors -- python problems??? p_motch Linux - Newbie 2 07-11-2004 08:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration