[Compiler-sig] My code runs - but I can't 'compile' it... WHY?!

Phil Hornby phil.hornby at accutest.co.uk
Mon Aug 2 15:54:29 CEST 2004


>> Hi out there...
>
> This isn't really a very good place to ask this question...

Strange I would think that the Compiler SIG would deal with the compiler
module - maybe I am missing something...

>> I have what seems to me like a VERY strange situation.
>>
>> I have some code that I want to compile - i.e. generate a .pyc file 
>> for - because I want to essentially hide the contents from prying eyes.
>
> I'll spare you the homily on how much use this is :-)

I realise that it is not going to stop a determined person - but it stops
someone simply opening the code in an editor which would be WAY to easy.

>> The code runs fine from a command prompt but when I try to compile it 
>> from an interactive session of the Python interpreter as below I get 
>> the error shown... ANY IDEAS??
>
> Why are you using Lib/compiler and not py_compile?  But it's hard to say
more without ... erm ... seeing some code.  
> Maybe you can comment things out and use binary chop to find the syntax
that is defeating Lib/compiler.  This would 
> be interesting in itself as I thought I'd fixed all of those problems...

Why an I using it - cos it was the first thing I came across when I type
compile into a help search... Seemed a reasonable module to use... I will
try to have a play to see where the problem comes in - could it be the fact
that I use my own modules written in C? I have a work around - I simply
import the module and that creates a .pyc file for me anyway. 

Thanks for your feedback though...

--
Phil



More information about the Compiler-sig mailing list