[Ironpython-users] importing third-party modules

Wolfgang Schmoller w.schmoller at gmx.de
Sat Jul 9 20:45:19 CEST 2011


I recognized some strange behaviour. I've zipped the lib-folder of the  
IronPython-directory and loaded it with the script-tag as in the tutorial.  
That works fine, but I am just able to access the files on the first level.

E.g. open("lib/base64.py") works, open("lib/ctypes/util.py") fails. I even  
zipped the directory with two different programs (Windows-built-in and  
IZArc). Everytime the same behaviour.

Best regards
Wolfgang

Am 04.07.2011, 00:10 Uhr, schrieb Wolfgang Schmoller <w.schmoller at gmx.de>:

> Thank you for your very quick reply!
>
> The site is actually run under an Apache Server, everything on one local  
> computer. Should I better take an IIS?
>
> I zipped the nltk-Folder from the site-packages directory, copied it to  
> the htdocs directory and included the zips as suggested, but it didn't  
> help.
>
> The relevant passages of the html-code:
> <script type="text/javascript">
>      window.DLR = {
>          path: 'dlr',
>          settings : {console : true}
>      }
> </script>
> <script src="dlr/dlr-20100305.js" type="text/javascript">
> </script>
>
> <script type="application/x-zip-compressed" src="nltk.zip"></script>
> <script type="application/python" src="code.py"></script>
>
> The logs just say, that no favicon was found and I tend to doubt, that  
> this is the problem...;-)
>
> Best regards
> Wolfgang
>
> Am 03.07.2011, 17:19 Uhr, schrieb Jimmy Schementi <jschementi at gmail.com>:
>
>> On Jul 3, 2011, at 9:32 AM, Dave Wald wrote:
>>> On 7/3/2011 5:30 AM, Wolfgang Schmoller wrote:
>>>> Hello,
>>>>
>>>> I'm working on a site, where I need to work with python. I have  
>>>> managed to configure that, so that I can use python instead of  
>>>> Javascript. Now, I need to import a third-party module (nltk -  
>>>> http://www.nltk.org/). I installed it in the commandline-version of  
>>>> IronPython and am able to import it with ipy. But I can't import it  
>>>> in the web application. I have tried to work with  
>>>> sys.path.append("path\to\nltk"), but the module can't be found.
>>>>
>>>> I use python via the <script>-tag.
>>>>
>>>> Best regards
>>>> Wolfgang Schmoller
>>>
>>> Wolfgang,
>>> Sounds like a permissions issue under your web server, which I'm  
>>> assuming is IIS. You didn't mention any implementation particulars.
>>> I would check that the account the process is running under has  
>>> specific permissions on the NLTK install folder.
>>> I'm pretty sure that would cause an import error.
>>>
>>> Best,
>>> Dave
>>
>> Wolfgang, sounds like you're referring to browser/silverlight scripting  
>> with IronPython? If so, take a look at the documentation:  
>> http://ironpython.net/browser/docs.html#zip-files; it shows how to make  
>> multi-file python modules available for import.
>>
>> ~Jimmy
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users


More information about the Ironpython-users mailing list