1
votes

in python,can i load a module from remote server to local? what i do this is want to protect my source code. what should i do ,thanks

3
are you sure this will protect your source code? To be imported it must be read anyway... - neurino
You are asking two different questions in one topic, or you are oferring a solution for your question, that both are wrong I think, and makes topic mixed up. (I dont give -1 for that, just a reminder) - saeedgnu

3 Answers

2
votes

it can be done via python import hooks. see knockout for an implementation that you can either use directly or as a starting point to add further code-protection logic

1
votes

A bit off topic but if source protection is what you need C-compile your python source with cython and distribute .pyd files.

You'll have to:

  1. adapt your source to be cython compilant (not all code can be converted)
  2. precompile .pyd files for platforms you want to support (Windows, Ubuntu, Fedora etc...)
0
votes

Yes, you can import your code in creative ways.

No, it will not protect the code from being seen. Rethink your strategy, not tactics.