How do I limit access to objects in Python?

T

Tommytrojan

Hi,

I have an application that embeds the Python interpreter. My users have
access to the interpreter through a console like window and they can run
Python scripts. For my application I use some Python modules (say module
Restricted) that I don't want to give my users access to. However, the
modules that I make public to my users and that I want my users to be
able to use themselves use the Restricted module. Any suggestions on how
to solve this? I was thinking of instantiating a separate interpreter
but I don't think this will solve my problem.

Thanks,
Thomas
 
D

Diez B. Roggisch

Tommytrojan said:
Hi,

I have an application that embeds the Python interpreter. My users have
access to the interpreter through a console like window and they can run
Python scripts. For my application I use some Python modules (say module
Restricted) that I don't want to give my users access to. However, the
modules that I make public to my users and that I want my users to be
able to use themselves use the Restricted module. Any suggestions on how
to solve this? I was thinking of instantiating a separate interpreter
but I don't think this will solve my problem.

I don't think that is possible - how is one to distinguish your code
from the code written by a user that calls one method in the restricted
module?

What you _can_ do is to spawn an interpreter, and expose the allowed
objects via Pyro.


The question is though: why cripple your users? If someone could reach
an otherwise unreachable goal why do yoou hinder him? What is the
reasoning behind that?

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top