Steve Baugh | 1 Jul 02:49 2011

Re: SQLite3

Thanks Jeff,

I will try it soon,

Steve

On Wed, 2011-06-29 at 21:00 -0700, Jeff Hardy wrote:
> Hi Steve,
> Please download a new copy of the file. The old one was built against
> a beta version of IronPython 2.7. It works in my quick testing.
> 
> - Jeff
> 
> On Wed, Jun 29, 2011 at 8:00 PM, Steve Baugh
> <stephen.baugh1@...> wrote:
> >
> > Jeff,
> >
> > Thank you for your reply.
> >
> > I have downloaded
> >
> > IronPython.SQLite-2.7.0_ipy-2.7_clr-v4.0.zip
> >
> > but can't make it work.
> >
> > I have put the IronPython.SQLite.dll in the DLLs folder and put the
> > sqlite3 folder under Lib.
> >
> > When I try:
(Continue reading)

no_reply | 1 Jul 14:26 2011

IronPython, Daily Digest 6/30/2011

Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:

ISSUES

ISSUES

1. [Status update] compile('#foo\n', '<stdin>', 'single') throws null ref exception view online

User jdhardy has updated the issue:

Status has changed from Proposed to Closed with the following comment,

"Duplicate of #30940."

2. [Status update] compile('#foo\n', '<stdin>', 'single') throws null ref exception view online

User jdhardy has updated the issue:

Status has changed from Proposed to Closed with the following comment,

"Duplicate of #30940."

_______________________________________________
Ironpython-users mailing list
Ironpython-users@...
http://mail.python.org/mailman/listinfo/ironpython-users
Steve Baugh | 1 Jul 23:24 2011

Re: SQLite3

Jeff,

Thank you for doing the updated file. I have downloaded it.

I have got it working but the plot thickens!

I put the new IronPython.SQLite.dll + sqlite3.dll into the DLLs
directory.
Doing import sqlite3 gave the _sqlite3 not found error.
I then put a copy of the dll in the same directory as ipy64.exe so it
was on the path, then started ipy64.exe by double clicking the file (if
you start it through the Start Menu the path isn't right).
after import clr and clr.AddReference("IronPython.SQLite")
I could then import sqlite3 correctly.

So this seems OK except that it did not automatically add the reference
by putting it in the DLLs directory.

I then tried to get things going under SharpDevelop,
after a lot of experiment I found that I had to put the dll and the
sqlite3 directory in
\Program Files (x86)\SharpDevelop\4.0\AddIns\BackendBindings
\PythonBinding

I could then add the reference but got _sqlite3 not found again.

I found eventually that the version ID of the SharpDevelop
IronPython.dll is 2.6.1008.2 whilst the IronPython 2.7 distribution is
2.7.0.40

So I then put the OLD dll in THIS directory (I still had a copy) and
things then started to work through the IDE!

Hope all this makes sense. I have only checked that I can import
sqlite3, I havn't tested the functionality yet.

BTW do I need sqlite3.dll as well?

Thanks

Steve

On Fri, 2011-07-01 at 01:49 +0100, Steve Baugh wrote:
> Thanks Jeff,
> 
> I will try it soon,
> 
> Steve
> 
> On Wed, 2011-06-29 at 21:00 -0700, Jeff Hardy wrote:
> > Hi Steve,
> > Please download a new copy of the file. The old one was built against
> > a beta version of IronPython 2.7. It works in my quick testing.
> > 
> > - Jeff
> > 
> > On Wed, Jun 29, 2011 at 8:00 PM, Steve Baugh
> > <stephen.baugh1@...> wrote:
> > >
> > > Jeff,
> > >
> > > Thank you for your reply.
> > >
> > > I have downloaded
> > >
> > > IronPython.SQLite-2.7.0_ipy-2.7_clr-v4.0.zip
> > >
> > > but can't make it work.
> > >
> > > I have put the IronPython.SQLite.dll in the DLLs folder and put the
> > > sqlite3 folder under Lib.
> > >
> > > When I try:
> > >
> > > import sqlite3
> > >
> > > in either ipy or ipy64 I get:
> > >
> > > ImportError: No module named _sqlite3
> > >
> > > I have put copies of sqlite.dll in both the IronPython 2.7 folder and
> > > the DLLs folder.
> > >
> > > When I import clr and try clr.AddReference("IronPython.SQLite") it seems
> > > to add the refrence (when the default path is right) but I still get the
> > > No module named _sqlite3 error with an import statement.
> > >
> > > The IronPython 2.7 installed to Program Files (x86) as it is a 64 bit
> > > system. I have also tried with with a Win XP 32 bit system.
> > >
> > > I am encouraged that you said it should work, but I seem to be doing
> > > something wrong....
> > >
> > > Steve
> > > On Wed, 2011-06-29 at 09:33 -0700, Jeff Hardy wrote:
> > >> You should be able to use IronPython.SQLite
> > >> (https://bitbucket.org/jdhardy/ironpython.sqlite/). There's a
> > >> 2.7-compatible build on the downloads page. It's not 100% compatible
> > >> with CPython sqlite, but it's pretty darn close.
> > >>
> > >> - Jeff
> > >>
> > >> On Mon, Jun 27, 2011 at 2:26 PM, Steve Baugh
> > >> <stephen.baugh1@...> wrote:
> > >> > I am trying to port a Linux Python program to IronPython and WPF. This
> > >> > program makes use of sqlite3. I am not trying to use data aware contols,
> > >> > I just want to issue SQL commands and get the results from SELECT
> > >> > statements.
> > >> >
> > >> > I have been getting conflicting, and in some cases contradictory,
> > >> > information from my web searches.
> > >> >
> > >> > Has anyone done this with IronPython 2.7 on .NET 4? I am am using
> > >> > SharpStudio in Windows 7 64 bit (but I am not trying to build a 64 bit
> > >> > application).
> > >> >
> > >> > Thanks,
> > >> >
> > >> > Steve
> > >> >
> > >> > _______________________________________________
> > >> > Ironpython-users mailing list
> > >> > Ironpython-users@...
> > >> > http://mail.python.org/mailman/listinfo/ironpython-users
> > >> >
> > >
> > >
> > >
> 
> 
no_reply | 2 Jul 16:53 2011

IronPython, Daily Digest 7/1/2011

Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:

ISSUES

ISSUES

1. [New issue] Scope is not remembered after an import view online

User WimVanLoocke has proposed the issue:

"When using ironpython to run py scripts, one creates in c# as scope for the engine, and sets a variable.

When running the .py file is executed and the scope is know.
When running a .py file that imports an other .py file( can contains ref to variable in the scope ) the variable is no longer know.

When looking into the code

{ snipped }
internal PythonModule/*!*/ CompileModule(string fileName, string moduleName, SourceUnit sourceCode, ModuleOptions options, out ScriptCode scriptCode) {

ContractUtils.RequiresNotNull(fileName, "fileName");

ContractUtils.RequiresNotNull(moduleName, "moduleName");

ContractUtils.RequiresNotNull(sourceCode, "sourceCode");

scriptCode = GetScriptCode(sourceCode, moduleName, options);

Scope scope = scriptCode.CreateScope();

return InitializeModule(fileName, ((PythonScopeExtension)scope.GetExtension(ContextId)).ModuleContext, scriptCode, options);

}

{ end snipped }

you can see that a new scope is created, and not the initial scope is used.

Init :
_Engine = Python.CreateEngine();
scope = _Engine.CreateScope();
scope.SetVariable("I2C", localEngine);
scope.SetVariable("UART", Poderosa);
scope.SetVariable("dbg", _txtOut);

_txtBox.InteractiveObj.Add("I2C", localEngine);
_txtBox.InteractiveObj.Add("UART", Poderosa);
_txtBox.InteractiveObj.Add("dbg", _txtOut);

Execute

_Engine.ExecuteFile(_PathToScript, scope);"

2. [New comment] Scope is not remembered after an import view online

User slide_o_mix has commented on the issue:

"This doesn't work in CPython either. Each module has it's own scope:

foo.py:
print "x = %d" % x
def foo():
x = globals()['x']
print "x = %d" % x


script.py:
x = 5
import foo

foo.doit()


OUTPUT:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 325, in RunScript
exec codeObject in __main__.__dict__
File "script.py", line 3, in <module>
import foo
File "foo.py", line 3, in <module>
print "x = %d" % x
NameError: name 'x' is not defined


"

_______________________________________________
Ironpython-users mailing list
Ironpython-users@...
http://mail.python.org/mailman/listinfo/ironpython-users
Wolfgang Schmoller | 3 Jul 12:30 2011
Picon
Picon

importing third-party modules

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
Dave Wald | 3 Jul 15:32 2011
Picon

Re: importing third-party modules

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
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users@...
> http://mail.python.org/mailman/listinfo/ironpython-users
>

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
Jimmy Schementi | 3 Jul 17:19 2011
Picon

Re: importing third-party modules

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@...
http://mail.python.org/mailman/listinfo/ironpython-users
Wolfgang Schmoller | 4 Jul 00:10 2011
Picon
Picon

Re: importing third-party modules

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@...>:

> 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
no_reply | 4 Jul 11:29 2011

IronPython, Daily Digest 7/3/2011

Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:

ISSUES

ISSUES

1. [New comment] Scope is not remembered after an import view online

User MarkusSchaber has commented on the issue:

"We had the same problem when embedding IronPython into CoDeSys. But this is how python works, so it cannot be changed by IronPython without breaking compatibility to 95% of all Python code around.

Our Solution was to use Python.CreateModule(engine, "scriptengine") to create a module. We then injected our C# objects into that module, and emulated an "from ... import *" by copying all scope members to the script scope on script startup. This allows imported modules to simply do "import scriptengine" and then access our injected C# objectes, without destroying the scope rules for ordinary python code."

_______________________________________________
Ironpython-users mailing list
Ironpython-users@...
http://mail.python.org/mailman/listinfo/ironpython-users
David Bagby | 3 Jul 17:25 2011

Undesired Side Effects of sending digests to the list as emails

Hi List,

I've been reading the list for a couple of months as part of an effort 
to learn more about Iron Python.

I thought I'd speak up about the recent decision to start sending the 
list daily digest to the list (as an email)....
I rather dislike the side effect of this and wanted to explain why... 
turning this option on has created a recursive problem.

If a list subscriber gets the list content as individual emails, the 
digest is just one more email they get -

However, if you choose to get the list email as a daily digest (as I 
do), sending the digest as an email to the list causes the digest to be 
inserted into the daily digest email.... and that makes for a very hard 
to read digest.
It also effectively doubles content of the digest (as today's digest 
ends up including an email from yesterday which is all of the prior 
day's  digest). This is ugly enough when you get daily digests, I hate 
to think about what this would look like if one opted for weekly digests 
instead of daily (I don't remember if this list offers weekly digests, 
some other lists I subscribe to do).

When someone then replies to an email and does not trim the quoted 
reply... well, at that point the you have a pretty massive amount of 
text within which it is darn near impossible to find the "new" content.

Now think about trying to read that on a typical mobile device (as I 
often do on my android phone)..... one ends up having to scroll thru 
pages and pages of useless text.

The net effect for me is that this recent change to the list has made 
reading the list painful enough that I've found myself just deleting the 
list emails instead of reading them. :-(

So, just in case anyone is counting raised hands, mine is up for "please 
turn this digest is sent to the list option back off".

Dave

Gmane