473,729 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling GPL code from a Python application

Hello,

One of the greatest feature of Python in my opinion is the way the
interpreter can be used to integrate a wide variety of
software packages by dynamically linking them. This approach has been
extremely successful for us so far but now I run
into a license nightmare.

Some the libraries we wrapped using SWIG are under GPL but the
applications we are distributing are not (mainly because
we are asked by funding agencies to keep track of users and hence ask
people to download the source from our site).

A google search about GPL and dynamic linking came up with an equal
number of pages saying that dynamic linking of GPL
code into non GPL applications is allowed as it is the end user who
cretes the derived work, as pages saying the opposite !
So does anyone know what to do about this ?

The second question I would like to get an answer for is whether doing
an "os.system('GPL app')" violates GPL if I ship
my Python code that does the os.system call and the GPLapp program ?

Thanks for any input.

Please reply to sa****@scripps. edu

--

-----------------------------------------------------------------------
o
/ Michel F. Sanner Ph.D. The Scripps Research Institute
o Associate Professor Department of Molecular Biology
\ 10550 North Torrey Pines Road
o Tel. (858) 784-2341 La Jolla, CA 92037
/ Fax. (858) 784-2860
o sa****@scripps. edu http://www.scripps.edu/~sanner
-----------------------------------------------------------------------
Jan 4 '06 #1
35 2887
Michel Sanner wrote:
A google search about GPL and dynamic linking came up with an equal
number of pages saying that dynamic linking of GPL
code into non GPL applications is allowed as it is the end user who
cretes the derived work, as pages saying the opposite !
So does anyone know what to do about this ?


The stance the FSF (and it's lawyers) take on this is that it is illegal to
dynamically link applications that are not under a GPL-compatible license
to GPL works, as you are creating a derived work of the GPL-led library by
using it directly in your runtime environment (that is in the same
process). That's what the LGPL (the lesser or library GPL) is for, which
explicitly permits closed source (amongst other) packages to link to
LGPL-led libraries.

If you call the extension program by os.system(), you are not creating a
derived work, though, as the resulting program might have a runtime
dependency on the GPL-led program, but both never share a runtime
environment (they are seperate processes, and as such you have not created
a derived work of the GPL-led library).

Note that I did never used the term "you must GPL your application" above,
but rather said that it is paramount that your application is under a
GPL-compatible license. See the FSF for more details on what licenses are
compatible (most modern BSD-derived are, e.g.).

--- Heiko.
Jan 4 '06 #2
Michel Sanner <sa****@scripps .edu> writes:
A google search about GPL and dynamic linking came up with an equal
number of pages saying that dynamic linking of GPL
code into non GPL applications is allowed as it is the end user who
cretes the derived work, as pages saying the opposite ! So does anyone
know what to do about this ?


According to the FSF, it is not permitted under the GPL. Some other
users have a differing opinion. The actual legality may eventually
have to be decided by a court; right now no such decision exists.

Of course, in the case where the GPL'd code's author is ok with what's
being done, it's fine either way (i.e. at worst, the author's
permission exists separately from the permissions granted by the GPL).
In the other case, you're asking to what extent it's legal for the
non-GPL author (typically a proprietary code developer) to thwart the
wishes of the GPL'd code's author and do things not in the GPL spirit.
Since proprietary code developers generally use the copyright system
to avoid having their own wishes thwarted, they're not entitled to
very much sympathy in their desires to construe the GPL to thwart the
wishes of other authors. It's preferable to ask what the GPL spirit
is and act that way, than to aggressively probe its exact legal
boundaries.
Jan 4 '06 #3
Michel Sanner <sa****@scripps .edu> writes:
One of the greatest feature of Python in my opinion is the way the
interpreter can be used to integrate a wide variety of
software packages by dynamically linking them. This approach has been
extremely successful for us so far but now I run
into a license nightmare.
Which is a good argument against IP in general, but that's another
issue.
A google search about GPL and dynamic linking came up with an equal
number of pages saying that dynamic linking of GPL
code into non GPL applications is allowed as it is the end user who
cretes the derived work, as pages saying the opposite ! So does anyone
know what to do about this ?
Yes. Ask the holders of the copyright.

The only way to find out *for sure* whether or not a license allows
something is to do that something, get sued about it, and get a judge
to tell you whether or not you violated the license. Different judges
may well give you different answers.

A critical step in that process is getting sued. The copyright holders
have to do that, so you'll need their cooperation for this. Of course,
if they don't think what you're going to do is a violation of the
license, they may not be willing to sue you, in which case you're out
of luck.

If you want an opinion about whether or not you would win such a
lawsuit, ask a lawyer you trust.

If you want to know the intent of the authors, that is that libraries
covered by the GPL would infect programs they are linked with, whether
it's dynamically or statically. The Library (now Lesser) GPL was
created to to allow programs to be linked with LGPL'ed libraries
without infecting the program. If the library in question was released
under the LGPL, the authors of the GPL say you can use it. Otherwise,
they say not. But see the above paragraphs about judges, copyright
holders and lawyers.
The second question I would like to get an answer for is whether doing
an "os.system('GPL app')" violates GPL if I ship
my Python code that does the os.system call and the GPLapp program ?


I'm pretty sure that doesn't violate the GPL. But IANAL, so...

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 4 '06 #4
Heiko Wundram <mo*******@bi t-bukket.org> writes:
The stance the FSF (and it's lawyers) take on this is that it is illegal to
dynamically link applications that are not under a GPL-compatible license
to GPL works


I doubt that, because it's simply not true. I can use GPL'ed code any
way I want to - that's part of the point of the GPL. I can change it
however I want, print it in whatever font I want on whatever material
I want, hang the result on the wall, and - most importantly - link it
with whatever other code I want.

What I *can't* do is distribute it (or work derived from it, etc.)
unless the entire work being distributed is under the GPL (unless the
license has changed recently, *not* a GPL-compatible license, but the
GPL itself), and meets the requirements of the that license. In
particular, if I distribute an application that has to be dynamically
linked with a GPL'ed library to run, I need to distribute my
application under the terms of the GPL.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 4 '06 #5
Mike Meyer wrote:
What I *can't* do is distribute it (or work derived from it, etc.)
unless the entire work being distributed is under the GPL (unless the
license has changed recently, *not* a GPL-compatible license, but the
GPL itself), and meets the requirements of the that license. In
particular, if I distribute an application that has to be dynamically
linked with a GPL'ed library to run, I need to distribute my
application under the terms of the GPL.


Is that really true, precisely as written?

It should be possible to distribute code which does have to be
dynamically linked with a GPL'ed library in order to run *without*
having to distribute under the GPL, provided your distribution *does not
include* the GPL'ed library.

Am I totally misremembering that the terms of the GPL talk only about
*distributing* GPLed code, not about using it, and certainly not about
writing other applications which might require it but which might have
entirely non-compatible licenses.

(Depending on one's definition of "applicatio n", you could still be
right because what I describe -- a program that can't run without adding
something else to it first -- might not be considered an application by
some people. I wonder what they'd call it though.)

-Peter

Jan 4 '06 #6
Peter Hansen <pe***@engcorp. com> writes:
Mike Meyer wrote:
What I *can't* do is distribute it (or work derived from it, etc.)
unless the entire work being distributed is under the GPL (unless the
license has changed recently, *not* a GPL-compatible license, but the
GPL itself), and meets the requirements of the that license. In
particular, if I distribute an application that has to be dynamically
linked with a GPL'ed library to run, I need to distribute my
application under the terms of the GPL. Is that really true, precisely as written?


Well, see my earlier post about how to *really* found out if you're
violating a license. But that is the intent of the GPL.
It should be possible to distribute code which does have to be
dynamically linked with a GPL'ed library in order to run *without*
having to distribute under the GPL, provided your distribution *does
not include* the GPL'ed library.
One would think so. The FSF disagrees. In particular, while they
explicitly state that putting GPL'ed code in a distribution doesn't
require that you distribute the entire distribution under the GPL, if
you then provide instructions on how to create a work derived from the
GPL'ed code from the contents of the distribution, they'll sue you
about it. At least, they sued NeXT when NeXT tried it. Failing to
include the GPL'ed code would seem to be no more a violation of the
letter, and no less a violate of the spirit.
Am I totally misremembering that the terms of the GPL talk only about
*distributing* GPLed code, not about using it, and certainly not about
writing other applications which might require it but which might have
entirely non-compatible licenses.
Correct. Which is why the first sentence of the above paragraph is
"What I *can't* do is distribute it ...". If I statically link a
GPL'ed library with my application, if I distribute it, it clearly has
to be under the terms of the GPL. If I dynamically link the library,
then it's not so clear, but the FSF clearly intends that this be the
same situation. If I fail to provide a library, and the only thing
that could be used is GPLed, it's the same situation. On the other
hand, if I provide a list of acceptable libraries, some GPL'ed, and
some not, then the situation is different, because you're not
depending on GPL'ed code, but allowing your clients to use it. Or
something like that.
(Depending on one's definition of "applicatio n", you could still be
right because what I describe -- a program that can't run without
adding something else to it first -- might not be considered an
application by some people. I wonder what they'd call it though.)


I don't think the term "applicatio n" is used in the GPL, and I don't
think it has any bearing on IP laws.

But IANAL.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 4 '06 #7
On Tue, 03 Jan 2006 16:36:31 -0800, Michel Sanner wrote:
Hello,

One of the greatest feature of Python in my opinion is the way the
interpreter can be used to integrate a wide variety of
software packages by dynamically linking them. This approach has been
extremely successful for us so far but now I run
into a license nightmare.
Various other people on the newsgroup have given varying advice. I can
only say: Why are you asking us? If you want legal advice, speak to a
lawyer.

At the very least, the best (if not only) canonical source of the GPL's
intention is gnu.org, not random googling for random thoughts by random
people, many of whom have bees in their bonnet about what they
(mis)understand the GPL to say.

In particular:

http://www.gnu.org/licenses/gpl-faq.html

[quote]

Q: If a library is released under the GPL (not the LGPL), does that mean
that any program which uses it has to be under the GPL?

A: Yes, because the program as it is actually run includes the library.

....

Q: Can I release a non-free program that's designed to load a GPL-covered
plug-in?

A: It depends on how the program invokes its plug-ins. If the program uses
fork and exec to invoke plug-ins, then the plug-ins are separate programs,
so the license of the plug-in makes no requirements about the main program.

If the program dynamically links plug-ins, and they make function calls to
each other and share data structures, we believe they form a single
program, which must be treated as an extension of both the main program
and the plug-ins. In order to use the GPL-covered plug-ins, the main
program must be released under the GPL or a GPL-compatible free software
license, and that the terms of the GPL must be followed when the main
program is distributed for use with these plug-ins.

If the program dynamically links plug-ins, but the communication between
them is limited to invoking the `main' function of the plug-in with some
options and waiting for it to return, that is a borderline case.

[end quote]
If you work must _link_ to the libraries in question (as opposed to
merely executing them), then it seems to me that your best bet would be to
ask the copyright holder(s) of the libraries you want to use for a licence
compatible with your needs. You may consider explaining why you can't use
the GPL, and if need be you might consider paying them for a non-GPL
licence. After all, if you can't use their libraries, you would have to
either licence somebody else's work, or pay somebody to develop something
for you.

(Just because programmers release work under the GPL doesn't mean they
won't do work for pay.)
The second question I would like to get an answer for is whether doing
an "os.system('GPL app')" violates GPL if I ship my Python code that does
the os.system call and the GPLapp program ?


Again, see the FAQs:

[quote]

Q: What is the difference between "mere aggregation" and "combining two
modules into one program"?
A: Mere aggregation of two programs means putting them side by side on the
same CD-ROM or hard disk. We use this term in the case where they are
separate programs, not parts of a single program. In this case, if one of
the programs is covered by the GPL, it has no effect on the other program.

Combining two modules means connecting them together so that they form a
single larger program. If either part is covered by the GPL, the whole
combination must also be released under the GPL--if you can't, or won't,
do that, you may not combine them.

What constitutes combining two parts into one program? This is a legal
question, which ultimately judges will decide. We believe that a proper
criterion depends both on the mechanism of communication (exec, pipes,
rpc, function calls within a shared address space, etc.) and the semantics
of the communication (what kinds of information are interchanged).

If the modules are included in the same executable file, they are
definitely combined in one program. If modules are designed to run linked
together in a shared address space, that almost surely means combining
them into one program.

By contrast, pipes, sockets and command-line arguments are communication
mechanisms normally used between two separate programs. So when they are
used for communication, the modules normally are separate programs. But
if the semantics of the communication are intimate enough, exchanging
complex internal data structures, that too could be a basis to consider
the two parts as combined into a larger program.

[end quote]
--
Steven.

Jan 4 '06 #8
On Tue, 03 Jan 2006 20:48:12 -0500
Mike Meyer <mw*@mired.or g> wrote:
If you want to know the intent of the authors, that is
that libraries covered by the GPL would infect programs
they are linked with, whether it's dynamically or
statically. The Library (now Lesser) GPL was created to to
allow programs to be linked with LGPL'ed libraries without
infecting the program. If the library in question was
released under the LGPL, the authors of the GPL say you
can use it. Otherwise, they say not. But see the above
paragraphs about judges, copyright holders and lawyers.


I have to say that in my conversations with developers, the
choice of the LGPL for Python libraries is only a matter of
signalling intent to library-users. All the ones
I've talked to seemed to think that the GPL allows dynamic
linking anyway, but they wanted to avoid any question about
it. Some other authors go ahead and use the GPL but provide
a notice of their interpretation along with the package.

As I read the GPL itself (but I am not a lawyer), it cannot
possibly restrict you from doing this (because your code
does not include a copy of the GPL'd work), and it
explicitly allows you to distribute the GPL'd library with
your application (provided you provide source code and keep
it separated in obvious ways from your own code -- such as
putting it in a separate archive file, etc). That's the
"mere aggregation" clause that allows that.

However, it is true that the FSF is unhappy with this
loophole and would like to pretend it isn't there, so those
warning you that you could get sued are probably right. I
just think that you would be in the right in such a case and
should win.

It is interesting to note that the FSF holds the position
that the language that "gives you this right" *doesn't* --
it just clarifies the fact that you already hold that right,
because it is provided by "fair use". Their position is
that it is not possible to restrict the *use* of software
you have legally acquired, because copyright only controls
copying.

In order to take away that right (according to the FSF
theory expressed in the preamble of the GPL), you must have
a *contract*, not merely a *license*. Generally if no
consideration was paid (it was zero-cost), and nothing was
signed, there can be no such contract. This is in conflict
with the "click-through" EULA theory, which the FSF denies
is legally binding. Thus their own arguments contradict
their desire to control your use of the software.

Mind you, I'm not necessarily rooting for either side of
this -- I'm just interpreting what I've read. The GPL is
a fascinating read, BTW, and it isn't particularly long. ;-)

Cheers,
Terry

--
Terry Hancock (ha*****@Anansi Spaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com

Jan 4 '06 #9
Terry Hancock <ha*****@anansi spaceworks.com> writes:
On Tue, 03 Jan 2006 20:48:12 -0500
It is interesting to note that the FSF holds the position
that the language that "gives you this right" *doesn't* --
it just clarifies the fact that you already hold that right,
because it is provided by "fair use". Their position is
that it is not possible to restrict the *use* of software
you have legally acquired, because copyright only controls
copying.


I believe there is precedent that contradicts the FSF's
position. There are two arguments against it:

1) Executing software involves several copy operations. Each of those
potentially violate the copyright, and hence the copyright holder
can restrict execution of a program.

2) Executing a program is analogous to a performance of the software.
Copyright includes limits on performances, so the copyright holder
can place limits on the execution of the software.

Personally, I agree with the FSF - if own a copy of a program,
executing it should be fair use. Without that, then there's no point
in obtaining software - you have to get the copyright holders
permission to execute the stuff anyway.

While I'm here, I'll point out the the "address space" argument is
specious. What if I bundle a standalone GPL'ed application with my own
application, and distribute binaries for a machine that has a shared
address space? By that criteria, I'd have to GPL my code for the
distribution for the shared address space machine, but not for a Unix
system. I'm not buying that.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jan 4 '06 #10

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

Similar topics

4
7303
by: Carlos P. | last post by:
Hi! I want to call tcl from python and python from tcl. The big picture is that I´m writing an application GUI with tcl/tk and application logic with python, so at least I want to call python events from the tk GUI. I have read about _tkinter and tkapp.call although I couldn´t find any detailed documentation. And, anyway, that seems to work in one direction (python->tcl) but I don´t know how to make it work in the other (tcl->python)....
10
2037
by: Kyler Laird | last post by:
I need to submit C/C++ code for a class. (It's not a programming class. The choice of language is inertial. I think that it mostly serves to distract students from the course subject.) I'm fairly fluent with C but it hurts to think about writing in C when Python is *so* much more appropriate for these operations. I'd like to keep my sanity and satisfy the course requirements by programming in Python and converting the code to C. It...
0
2302
by: Natsu Mizutani | last post by:
Hello, I'm trying to wrap a c++ library using MPI inside with boost.python (or SWIG). I managed to find that calling `MPI::Init()` embeded in a c++ funtion would not work. So, I decided to use `pyMPI`. To avoid overhead of pickling and unpickling while calling `mpi.send` in Python, I'd rather call c++ functions `MPI::Isend()` etc. embeded in a c++ function.
2
2566
by: Jarppe | last post by:
Hello, What should I do to be able to call Pyhton interpreter from a posix thread that is created in C? I have a C-library that creates a thread and then makes callbacks to user supplied function from that threads context. I'm writing a wrapper for this library and I need to call python interpreter from that callback. I'm using Python 2.3 in Linux.
2
3058
by: calfdog | last post by:
Hello, Does anyone know a workaround for calling fireEvent. With the latest from Microsoft OS XP2 and Hot fixes to IE it now gives an "access denied" error in Python when called. Here is what I am trying to do: Set the "campus" listbox value and theb call fire event, such as in the code below. I get an "access denied" error.
5
2077
by: robert.differentone | last post by:
I am a newbie to Python. I want to call python functions from C. I looked for examples but I couldn't get any simple one. Lets say my python code is : def add(a,b) return (a+b) I want to call add from C. Could anybody please help me? Thanks in advance. R.
10
13302
by: Finger.Octopus | last post by:
Hello, I have been trying to call the super constructor from my derived class but its not working as expected. See the code: class HTMLMain: def __init__(self): self.text = "<HTML><BODY>"; print(self.text); def __del__(self): self.text = "</BODY></HTML>"; print(self.text);
3
2081
by: Anthony Smith | last post by:
In my php page I am calling a Python cgi. The problem is that originally the Python script was being called directly and it could access the environment variables that were being set. Now since the php script is being called first it has access to the environment variables, but the Python script does nt. How can I forward the variables or call the Python script in such a way where it can access those variables? These are the type of...
4
6188
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages generated are written to a log file. A project team working in the same company as me here would like to use this loading utility. They write UI applications for Windows using Java. They were able to launch the Python script from within Java by...
16
3783
by: Jaco Naude | last post by:
Hi there, This is my first post over here and I hope someone can give me some guidance. I'm trying to embed Python into a Visual C++ 2008 application and I'm getting linker problems. I've compiled a DLL of the Python source code using the pythoncode VC++ project in the PCbuild folder of the source download and this works 100% without any warnings etc. I've done this in Debug and Release mode without any problems.
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6022
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.