473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How would i see .pyc files when i execute a python file

I wanted to see the python compiled files (.pyc) when i execute python .py files.
help me how would i get .pyc files generated.
Nov 21 '06 #1
6 3200
bartonc
6,596 Expert 4TB
I wanted to see the python compiled files (.pyc) when i execute python .py files.
help me how would i get .pyc files generated.
The .pyc file is generated automatically when you execute python a .py file from the command line (python mymodule.py) and it will be in the same directory as the .py file that you executed. IDLE has a curious way of not doing this which I don't understand. Most other IDEs will generate the .pyc files also.
Nov 21 '06 #2
bartonc
6,596 Expert 4TB
I wanted to see the python compiled files (.pyc) when i execute python .py files.
help me how would i get .pyc files generated.
You can force IDLE to generate a .pyc file of "aModule.py" like this:

in "myModule.py" type:
Expand|Select|Wrap|Line Numbers
  1.  
  2. import aModule
  3.  
then, in the menu:
Run-> Run Module
Nov 21 '06 #3
Thanks for the reply . I got it
Nov 22 '06 #4
bartonc
6,596 Expert 4TB
Thanks for the reply . I got it
Any time. Keep posting,
Barton
Nov 22 '06 #5
As long as this thread is still open, the easiest way to compile a python file into .pyc is the following:

You have a file, "C:/documents and settings/user/not_compiled.py". You want to compile that file. Create another python file in the same directory. In that file, type "import not_compiled". That will run the program as a module, but it will also compile the program into a .pyc file in the same directory as the original file.
Dec 1 '06 #6
bartonc
6,596 Expert 4TB
As long as this thread is still open, the easiest way to compile a python file into .pyc is the following:

You have a file, "C:/documents and settings/user/not_compiled.py". You want to compile that file. Create another python file in the same directory. In that file, type "import not_compiled". That will run the program as a module, but it will also compile the program into a .pyc file in the same directory as the original file.
Isn't that what I said?
Dec 1 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Sylvain Thenault | last post by:
Hi there ! I've some questions regarding pth files (which btw are undocumented in the python reference, is this intentional ?) I thought that I could use a .pth file to be able to import zope...
10
by: TokiDoki | last post by:
Hello there, I have been programming python for a little while, now. But as I am beginning to do more complex stuff, I am running into small organization problems. It is possible that what I...
1
by: jeem | last post by:
I am using ActiveState Komodo 3.5 to work on a large python 2.4 application with an extensive UI... I am attempting to debug the application and am setting breakpoints in 4 different *.py files.....
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
8
by: why? | last post by:
Im working with Python 2.2 on my red hat linux system. Is there any way to write python codes in separate files and save them so that i can view/edit them in the future? Actually I've just started...
7
by: mosscliffe | last post by:
I have 4 text files each approx 50mb. I need to join these into one large text file. I only need to do this very occasionally, as the problem has occurred because of upload limitations. ...
8
by: Edward A. Falk | last post by:
IOW, is there a "linker" for python? I've written a program comprised of about five .py files. I'd like to find a way to combine them into a single executable. Obviously, I could hand-edit them...
7
by: flarefight | last post by:
I am trying to make a a simple databasing GUI interface and and have created a module to deal with parsing the data from a file and a GUI based program that displays this data using PyQt4, i know...
5
by: Matias Surdi | last post by:
aditya shukla escribió: Maybe py2exe can help you.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.