473,545 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Are .pyc files portable?

Python compiles to bytecode, which means that pyc files can be
interpreted by any Python executable regardless of platform.

As for manual compilation to directories, the py_compile module is the
one you want. Here's an example program to plug in.

#test_compile.p y#

import py_compile

print "hello"
py_compile.comp ile("test_compi le.py", "C:\test_compil e.pyc")
The manual page for py_compile.comp ile() can be found on this page:
http://www.python.org/doc/2.5.2/lib/...pycompile.html

Hope that helps.
Cheers,
Wubbulous
Nov 8 '08 #1
1 2953
On Fri, 07 Nov 2008 19:01:31 -0800, Wubbulous wrote:
Python compiles to bytecode, which means that pyc files can be
interpreted by any Python executable regardless of platform.
No, bytecode isn't compatible from one version number to another.

--
Steven
Nov 8 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5202
by: Efrat Regev | last post by:
Hello, I would like to recurse through a directory and make files (which match a specific criteria) read only. From searching the Internet, I found http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303343 which shows how to change file attributes to read only using the win32api module. That's great, but I was hoping there's a more...
15
11759
by: Rex_chaos | last post by:
I am a c programmer and new to C++. In C, I am familiar with some operations on file. Now when shifting from c to c++, using iostream, I have no idea how to perform the following operations 1. check if a file or directory exists or not 2. delete all the files under a given directory 3. rename
27
4894
by: Eric | last post by:
Assume that disk space is not an issue (the files will be small < 5k in general for the purpose of storing preferences) Assume that transportation to another OS may never occur. Are there any solid reasons to prefer text files over binary files files?
8
1322
by: jvyyuie | last post by:
// My email is jvyyuie@hotmail.com // I want to make some friends and discuss about programing. #include "stdafx.h" #include <malloc.h> #include <string.h> #define sec1 (c=buffer)&&(c>0x80&&c<0xA1||c>0xA9&&c<0xFF) #define sec2 (c=buffer)&&(c>0xA0&&c<0xAA) void Convert2PureChinese(unsigned char* buffer)
15
1714
by: Xarky | last post by:
Hi, Is it possible to make use of data files in C? If yes can someone tell how or suggest me a site from where I can learn them. Thanks in Advance for your patience.
7
32870
by: Kristan | last post by:
Hi there, quick question, how would I retrieve a list of files in ANSI C in a purely platform independent way? Any pointers would be great! thanks Kristan
3
3828
by: masood.iqbal | last post by:
Hi, Kindly excuse my novice question. In all the literature on ifstream that I have seen, nowhere have I read what happens if you try to read a binary file using the ">>" operator. I ran into the two problems while trying to read a binary file. 1). All whitespace characters were skipped 2). Certain binary files gave a core dump
9
2869
by: deepakvsoni | last post by:
are binary files portable?
17
9880
by: byte8bits | last post by:
How does C++ safely open and read very large files? For example, say I have 1GB of physical memory and I open a 4GB file and attempt to read it like so: #include <iostream> #include <fstream> #include <string> using namespace std; int main () {
30
2038
by: Jrdman | last post by:
hi there can any one write a C code that search for files in a directory without using the windows apis(FindFirstFile() and FindNextFile()) or even has a small idea on how to do that. thanks.
0
7502
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7791
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.