making my extensions work together

2011-08-03 Thread Mathew
This isn't exactly a Python question but maybe someone here has run into 
this.

I have 2 extensions and they both access a function in a (static) library. 
The function maintains state information using a static variable.

This doesn't work. When one of my extensions changes the variable value, the 
other extension does not see the change.

Would it work if I made my library dynamic?

This is on Windows XP compiling with MSVC 2008.

-Mathew 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: making my extensions work together

2011-08-04 Thread Mathew
more info.  I have a large 3rd party library with a function that looks like 
this
void dumbfunc() {
static int statevar=0;
++statevar;
if (startvar ==3) printf("I have been called 3 times\n");
}

and I have 2 extensions, foo,py goo.py,created with SWIG, and the both make 
calls to dumbfunc. In creating the extensions, I linked to the 3rd party 
library.

The behavior I want to see is
>foo.dumbfunc()
>goo.dumbfunc()
>goo.dumbfunc()
I have been called 3 times


"Chris Angelico"  wrote in message 
news:mailman.1880.1312441742.1164.python-l...@python.org...
> On Thu, Aug 4, 2011 at 2:19 AM, Mathew  wrote:
>> I have 2 extensions and they both access a function in a (static) 
>> library.
>> The function maintains state information using a static variable.
>
> If your extensions are DLLs and they're both linking to the same
> static library, you should have two independent copies of that library
> - which would mean they don't interfere with one another. That's why
> the other extension doesn't see the change, and normally this is the
> correct and desired behaviour.
>
> Having the two be aware of each other is potentially very messy. As
> Stefan suggested, making one depend on the other would be a lot
> simpler. Alternatively, there may be ways to have the two extensions
> share data through Python itself. What are you looking to accomplish?
>
> ChrisA 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: making my extensions work together

2011-08-04 Thread Mathew
okay. It worked to make my 3'rd party library dynamic. Hopefully this will 
help someone else in the future.


"Mathew"  wrote in message 
news:j1cs2t$j2f$1...@news.jpl.nasa.gov...
> This isn't exactly a Python question but maybe someone here has run into 
> this.
>
> I have 2 extensions and they both access a function in a (static) library. 
> The function maintains state information using a static variable.
>
> This doesn't work. When one of my extensions changes the variable value, 
> the other extension does not see the change.
>
> Would it work if I made my library dynamic?
>
> This is on Windows XP compiling with MSVC 2008.
>
> -Mathew
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for python/pyramid developers for a project

2011-08-23 Thread Mathew
Hello,

My company an ISP is looking to build an administrative webapp
dashboard for our underlying systems. We are looking to hire a
developer(s) immediately. We would prefer the application be built on
python with a popular framework such as pyramid. This position is a
contract position paid hourly (35-45$ based on experience). Please
email me if you are interested and attach any relevant past projects/
screenshots that were built on pyramid/python.


email: mzummo at [gmail.com]
skype " mzummo "


-- 
http://mail.python.org/mailman/listinfo/python-list


setup.py rebuilds EVERYTHING on windows?

2011-05-02 Thread Mathew
Hi
I'm trying to build an extension (spice-0.12) on windows. Whenever I change 
a single file, everything gets rebuilt.

??

Python2.7.1
Windows XP Visual Studio 9
setuptools 0.6c11

-Mathew 


-- 
http://mail.python.org/mailman/listinfo/python-list


Windows Registry Keys

2011-05-19 Thread Mathew
Hi
I have installed a new version of Python27 in a new directory. I want to get 
this info into the registry so, when I install Numpy, it will use my new 
Python

TIA
-Mathew 


-- 
http://mail.python.org/mailman/listinfo/python-list


placing a Python com object into Excel

2008-03-17 Thread Mathew
Hi
I have seen examples from Mark Hammonds book where a Python COM object 
is accessed from Excel with a VBA script. But, what if I want to Insert 
a Python COM into the Sheet itself?

When I try this, a list of available objects appear. But my object isn't 
on the list.

Anybody have any ideas?

Mathew
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: placing a Python com object into Excel

2008-03-17 Thread Mathew
Thanks for the tip. But, instead of an AddIn, what if I want to be able 
to insert an object? I see that the demo adds items to the windows 
registry under \Excel\AddIns. Is there a similar location for the 
"Insert Object" command?

yikes. More Excel programming than I'd like to know.

Mathew



Méta-MCI (MVP) wrote:
> Hi!
> 
> Perso, I started from "excelAddin.py" (in 
> C:\Python25\Lib\site-packages\win32com\demos).
> And, I'm happy with the result (who run OK with Excel 2000, XP, 2007).
> 
> @-salutations
-- 
http://mail.python.org/mailman/listinfo/python-list


Python26 compilation problem

2008-10-23 Thread Mathew

I am getting
Modules/config.c:39: error: expected declaration specifiers or '...' 
before numeric constant


because of
extern void initsocket(2)(void);

in config.c

What is this? How do I fix it?


Mathew
--
http://mail.python.org/mailman/listinfo/python-list


Problem with Python GUI checklist, Tkinter

2011-03-07 Thread Mathew Coyle
Hi all,

I am trying to create a checklist which allows users to select a specific 
feature of a dataset in a database, and export that feature out of the database 
to their PC. This is my first GUI attempt, and I don't imagine my issue is too 
complicated, mostly just my inexperience.

Everything seems to roll along fine, a few tweaks are still needed, but an 
issue I cannot resolve has come up. It seems that the checklist items are being 
selected and added twice to the list, once for a mouse button click, and again 
for a mouse button release. I thought it would be a simple tag or bind 
somewhere, like the Python Tk buttons, to limit the selection to the mouse 
button click only, but I cannot find it anywhere in the documentation.

I am using Python 2.6.5, Tk 8.5 and I've attached the code as it stands now.

Any assistance would be appreciated, thanks.

Mathew Coyle
GIS Analyst
Information Technology
Alberta-Pacific Forest Industries Inc.
Phone: 780.525.8556
Fax: 780.525.8388
E-mail: mathew.co...@alpac.ca<mailto:mathew.co...@alpac.ca>

[cid:image001.png@01CBDCB3.8837DC10]

<>

PUexport_tool.py
Description: PUexport_tool.py
-- 
http://mail.python.org/mailman/listinfo/python-list


Merging xls into a common one

2013-10-16 Thread John Mathew
This code works fine when there are xls in which Row has One column, but
not when Row has more column.
The expectation is to merge the different xls into a common one.
Can somebody please help.


import xlwt
import xlrd
import sys
#Create workbook and worksheet

wbk = xlwt.Workbook()
dest_sheet = wbk.add_sheet('Data_1')

for sheet_idx in range(1, 3):
sheet = xlrd.open_workbook('Data_%d.xls' % sheet_idx).sheet_by_index(0)

for i in range(5):
values = sheet.row_values(i)
for idx, element in enumerate(values):
dest_sheet.write(i, sheet_idx+idx, element)

wbk.save('DATA.xls')
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python not working on my system

2015-10-13 Thread Mathew Carrick
Hi Cinto,

Python 3.5 does not work on Windows XP. Can you use Python 3.4 instead?

Best,
Mathew Carrick

On Tue, Oct 13, 2015 at 12:10 AM, Cinto Llach  wrote:

> I’m sending you this email, as I’m having problems trying to install and
> use Python.
>
>
>
> I’ve been tryng to install Python on one System :
>
> HP Intel Core 2 Duo 4300, 1,8 GHz
>
> 2 Gb RAM
>
> Windows XP Professional SP 3
>
>
>
> And I’ve got the following screens, with no visible Command Buttons. I’ve
> been able to proceed by blind testing in the forms ...
>
>
>
>
>
> Setup was successful ...
>
>
>
>
>
> It appears in Start Menu ...
>
>
>
> [image: cid:image003.png@01D10513.21E3F4C0]
>
>
>
> But when trying to launch pythonw.exe :
>
>
>
>
>
> Or python.exe :
>
>
>
>
>
> And when uninstalling, the form show no buttons ...
>
>
>
>
>
> But after finding the locations to click ...
>
>
>
>
>
> I will thank you if you can provide any help.
>
>
>
> Best wishes.
>
>
>
> Cinto Llach
>
> cll...@outlook.com
>
> cll...@email.com
>
>
>
> 034 622401038
>
>
>
> Barcelona
>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request

2015-10-13 Thread Mathew Carrick
Hi Uday,

Pip should support using the pip{version} command to install
version-specific packages. Try using pip2.7 to install 2.7 packages.

Best,
Mathew Carrick

On Tue, Oct 13, 2015 at 2:45 AM, Uday Pethakamsetty <
uday.pethakamse...@infor.com> wrote:

> Hi
>
>
>
> I am working on python 2.x for long time.
>
>
>
> I thought of testing python 3.5 for possible usage.
>
>
>
> The problem is that when I installed python 3.5, all the pip installs are
> directing to python 3.5, instead of my native python 2.7.
>
>
>
> I heard of a feature called pylauancher; but I didn’t find any satisfying
> documentation on it.
>
>
>
> Either pylauncer, or something else Solution—could you help reply the
> possible solution to work comfortably on either versions, without
> interfering, in my windows 64 bit machine.
>
>
>
>
>
> Thanks & regards
>
>
>
> Udhay Prakash
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


HTTP or alternative upload for large files

2006-12-18 Thread Jacob Mathew
Hay Robin..

 

I am Jacob Mathew.. Doing some research in large file uploads for my
project. I got your matured skills and ability to do programs for upload
huge files. In fact I am a kid in programming, I cannot think to write such
a god program. Will you able to share your uploading script with me so that
it will be useful to me.. 

 

Waiting for Your Reply

 

Thanks & Regards 

Jacob Mathew

 

 

-- 
http://mail.python.org/mailman/listinfo/python-list

[no subject]

2008-11-16 Thread anish mathew
pls help me    

    html page conecting to database sql or .mdb files

    pls sent qury


  Check out the all-new face of Yahoo! India. Go to http://in.yahoo.com/--
http://mail.python.org/mailman/listinfo/python-list


Concise way to format list/array to custom(hex) string

2008-08-02 Thread Kurien Mathew

Hello,

What will be a concise & efficient way to convert a list/array.array of 
n elements into a hex string? For e.g. given the bytes

[116, 111, 110, 103, 107, 97]
I would like the formatted string
0x74 0x6f 0x6e 0x67 0x6b 0x61

Is there an approach better than below:
hex = ''
for b in bytes:
hex += ('0x%x '%b)


Thanks
Kurien

Test program:
import array
import sys

bytes = array.array('B')
bytes.fromstring("tongka")
print bytes
hex = ''
for b in bytes:
hex += ('0x%x '%b)
print hex

--
http://mail.python.org/mailman/listinfo/python-list


Good python equivalent to C goto

2008-08-16 Thread Kurien Mathew

Hello,

Any suggestions on a good python equivalent for the following C code:

while (loopCondition)
{
if (condition1)
goto next;
if (condition2)
goto next;
if (condition3)
goto next;
stmt1;
stmt2;
next:
stmt3;
stmt4;
 }



Thanks
Kurien
--
http://mail.python.org/mailman/listinfo/python-list


pexpect and unicode strings

2009-09-04 Thread Mathew Oakes
Is there anything that can be done to make pexpect spawns send unicode lines?

In this example they are just middot characters, but this process
needs to be able to handle languages in other character sets.

>>> spokentext = u'Nation . Search the FOX  Nation . czars  \xb7  Health care  
>>> \xb7  town halls  \xb7  tea parties  ...'
>>> p = pexpect.spawn('festival')
>>> p.expect('festival> ')
0
>>> p.sendline( spokentext )
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/dist-packages/pexpect.py", line 961, in sendline
n = self.send(s)
  File "/usr/lib/python2.6/dist-packages/pexpect.py", line 953, in send
c = os.write(self.child_fd, s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in
position 41: ordinal not in range(128)
>>>

Help appreciated!

cheeers
Mat
-- 
http://mail.python.org/mailman/listinfo/python-list


Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Anoop Thomas Mathew
With my heartfelt condolence, I'd like to inform you all the unfortunate
demise of Mr.Kenneth Gonsalves (KG - law...@thenilgiris.com), who was a
strong advocate of Python, Django and Free Software in India.
He had served as the President of IPSS(Indian Python Software Society),
which initiated the PyCon India, done a lot of workshops on Python and was
an active member in the Django user group.

Anoop Thomas Mathew
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Demise of Mr. Kenneth Gonsalves

2012-08-03 Thread Anoop Thomas Mathew
Chronic Asthma. He was hospitalized yesterday, and passed away today.




On 3 August 2012 20:45, Marcin Tustin  wrote:

> What happened to him? He was posting on this list in the last week?
>
> On Fri, Aug 3, 2012 at 11:12 AM, Anoop Thomas Mathew wrote:
>
>> With my heartfelt condolence, I'd like to inform you all the unfortunate
>> demise of Mr.Kenneth Gonsalves (KG - law...@thenilgiris.com), who was a
>> strong advocate of Python, Django and Free Software in India.
>> He had served as the President of IPSS(Indian Python Software Society),
>> which initiated the PyCon India, done a lot of workshops on Python and was
>> an active member in the Django user group.
>>
>>
>> Anoop Thomas Mathew
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Marcin Tustin
> Tel: 07773 787 105
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylagiarism -- Need help now! Please provide code...

2012-08-14 Thread Anoop Thomas Mathew
On 14 August 2012 12:04, Simon Cropper
wrote:

> Hi Everyone,
>
> I just had a great idea for a new python module. I haven't bothered
> googling it or doing any research.
>
> I need help putting together some code; today preferably, my boss is on my
> back. Can someone please contribute a functioning module showing me how to
> do it?
>
> Once I have all your submissions, I will compile a functioning  package,
> which I hope to sell. Don't worry, no one will be at risk of being sued, I
> don't intend to credit you with the code and you will not know anything
> about what I have done because I don't intend to post and feedback to the
> list. Licenses are not a problem either, I don't believe in them and even
> if you find out I have plagiarized your stuff you have bub-kiss chance of
> suing me as I am in another jurisdiction.
>
> So, now you know where I am coming from, I would like to thank you for all
> your help. Remember though, I need help now, so please stop what you are
> doing and submit something quickly. I'm waiting...
>
> Still waiting...
>
> Hey, stop reading and get on with writing some code, I don't have all day!


Let the boss wait. Learn some mailing list etiquette first. It will help
you for sure.


>
>
> --
> Simon
>
> Disclaimer  :) Please don't flame me, I have written this with my tongue
> in my cheek and a light hearted take on some people request for assistance
> on a range of mail lists. It was not meant to target anyone in particular
> only to exaggerate how some people's requests appear to lurkers and
> contributors on many fora I frequent.
> --
> http://mail.python.org/**mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: simple client data base

2012-09-03 Thread Anoop Thomas Mathew
Hi,

You can make use of sqlite database also.
And for the structure, you can create a single table and different columns
for the fields like name, number etc.
You can get more details over here.
http://docs.python.org/library/sqlite3.html

Thanks,
Anoop Thomas Mathew

atm
___
Life is short, Live it hard.




On 3 September 2012 19:51, loïc Lauréote  wrote:

>
> Hi,
>
> You can try gadfly !
> This system is based on SQL.
>
> Loïc
> *
> ***
>
>
>
> > From: markrri...@aol.com
> > Subject: simple client data base
> > Date: Mon, 3 Sep 2012 10:12:11 -0400
> > To: python-list@python.org
>
> >
> > Hello all, I am learning to program in python. I have a need to make a
> > program that can store, retrieve, add, and delete client data such as
> > name, address, social, telephone number and similar information. This
> > would be a small client database for my wife who has a home accounting
> > business.
> >
> > I have been reading about lists, tuples, and dictionary data
> > structures in python and I am confused as to which would be more
> > appropriate for a simple database.
> >
> > I know that python has real database capabilities but I'm not there
> > yet and would like to proceed with as simple a structure as possible.
> >
> > Can anyone give me some idea's or tell me which structure would be
> > best to use?
> >
> > Maybe its a combination of structures? I need some help.
> >
> > Thanks for your help.
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Script Works Locally But Not Remotely with SSH

2012-04-02 Thread Anoop Thomas Mathew
Hi,
You can try using  ssh -X  xxx.xxx.xxx.xxx for GUI ssh connection.

Thanks,
Anoop Thomas Mathew
atm
___
Life is short, Live it hard.




On 28 March 2012 06:21, goldtech  wrote:

> Hi,
>
> I have a WinXP PC running an SSH server and I have a Linux PC with an
> SSH client  and logged into the XP seemingly OK. It's all on my
> personal LAN, the connection seems OK.
>
> I have a py file on the XP that I run via SSH from the Linux, it's:
>
> import webbrowser
> webbrowser.open('www.google.com')
>
> This runs OK started on the local XP PC, the browser Firefox opens and
> goes to the site, or it opens a tab to the site. But executing that
> same file via SSH does not open Firefox...doing it via SSH starts
> Firefox ( I see it begin in the process manager and I see web
> activity) but Firefox does not open it's window.
>
> Why the does the window not open when the script is started remotely?
>
> Thanks.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: string to list

2012-06-14 Thread Anoop Thomas Mathew
Hi,

You can use literal_eval from ast package.

>>> from ast import literal_eval
>>> list(literal_eval("'aa','bb','cc'")

this will return ['aa', 'bb', 'cc']

Thanks,
Anoop Thomas Mathew

atm
___
Life is short, Live it hard.




On 14 June 2012 12:28, Shambhu Rajak  wrote:

> This will do you job:
>
> >>> a = 'AAA,",,",EEE,FFF,GGG'
> >>> b = []
> >>> for x in a.split(','):
> ... if (x.find("\"") > -1):
> ... x = x.strip("\"")
> ... b.append(x)
>
> If you want reduce the lines of code u can go for this option:
> b = [x.strip("\"") for x in a.split(',')]
>
>
> So Just Cheerz,
> -Shambhu
>
> -Original Message-
> From: bruce g [mailto:bruceg113...@gmail.com]
> Sent: 14/06/2012 8:00 AM
> To: python-list@python.org
> Subject: string to list
>
> What is the best way to parse a CSV string to a list?
>
> For example, how do I parse:
>'AAA,",,",EEE,FFF,GGG'
> to get:
>['AAA','BBB,CCC,','EEE','FFF','GGG']
>
> Thanks,
> Bruce
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: string to list

2012-06-14 Thread Anoop Thomas Mathew
@group: Sorry for the mistake.
@Hemanth: Thank You for pointing out.
I just realized that, we should not copy paste from the console. :)

atm
___
Life is short, Live it hard.




On 14 June 2012 13:09, Hemanth H.M  wrote:

> @Annop Nice one, but you seem to have missed a parenthesis.
>
> >>> list(literal_eval("'aa','bb','cc'")  should have been >>>
> list(literal_eval("'aa','bb','cc'"))
>
-- 
http://mail.python.org/mailman/listinfo/python-list


REG: Interactive Python (ipython notebook) Tutorial for Beginners

2013-11-08 Thread Anoop Thomas Mathew
Hi All,

Lately, I've been working on a ipython notebook tutorial for beginners. The
idea is that, those who have basic idea about computers should be able to
pick up python very easily.

https://bitbucket.org/atmb4u/python-live/

I have completed 25 chapters. Would love some reviews, suggestions and
corrections.
I seriously think there are some loose ends for beginners. Will be awesome
if someone can fill in some beginner perspectives on it. Especially on the
getting started part.
Feel free to fork, make corrections and send a pull request.

Expecting some serious feedback through  pull requests.

Thanks and Regards,
ATM
-- 
https://mail.python.org/mailman/listinfo/python-list


Copying a ZipExtFile

2009-10-23 Thread Moore, Mathew L
Hello all,

A newbie here.  I was wondering why the following fails on Python 2.6.2 
(r262:71605) on win32.  Am I doing something inappropriate?

Interestingly, it works in 3.1, but would like to also get it working in 2.6.

Thanks in advance,
--Matt


import io
import shutil
import tempfile
import zipfile

with tempfile.TemporaryFile() as f:
# (Real code retrieves archive via urllib2.urlopen().)
zip = zipfile.ZipFile(f, mode='w')
zip.writestr('unknowndir/src.txt', 'Hello, world!')
zip.close();

# (Pretend we just downloaded the zip file.)
f.seek(0)

# Result of urlopen() is not seekable, but ZipFile requires a
# seekable file.  Work around this by copying the file into a
# memory stream.
with io.BytesIO() as memio:
shutil.copyfileobj(f, memio)
zip = zipfile.ZipFile(file=memio)
# Can't use zip.extract(), because I want to ignore paths
# within archive.
src = zip.open('unknowndir/src.txt')
with open('dst.txt', mode='wb') as dst:
shutil.copyfileobj(src, dst)


The last line throws an Error:


Traceback (most recent call last):
  File "test.py", line 25, in 
shutil.copyfileobj(src, dst)
  File "C:\Python26\lib\shutil.py", line 27, in copyfileobj
buf = fsrc.read(length)
  File "C:\Python26\lib\zipfile.py", line 594, in read
bytes = self.fileobj.read(bytesToRead)
TypeError: integer argument expected, got 'long'


-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Copying a ZipExtFile

2009-10-26 Thread Moore, Mathew L
> En Fri, 23 Oct 2009 14:15:33 -0300, Moore, Mathew L
> 
> escribió:
> 
> > with io.BytesIO() as memio:
> > shutil.copyfileobj(f, memio)
> > zip = zipfile.ZipFile(file=memio)
> > # Can't use zip.extract(), because I want to ignore paths
> > # within archive.
> > src = zip.open('unknowndir/src.txt')
> > with open('dst.txt', mode='wb') as dst:
> > shutil.copyfileobj(src, dst)
> >
> >
> > The last line throws an Error:
> >
> >
> > Traceback (most recent call last):
> >   File "test.py", line 25, in 
> > shutil.copyfileobj(src, dst)
> >   File "C:\Python26\lib\shutil.py", line 27, in copyfileobj
> > buf = fsrc.read(length)
> >   File "C:\Python26\lib\zipfile.py", line 594, in read
> > bytes = self.fileobj.read(bytesToRead)
> > TypeError: integer argument expected, got 'long'
> 
> Try adding a length parameter to the copyfileobj call, so the copy is
> done in small enough chunks.
> 


Hmmm...tried a variety of lengths (512, 1024, etc.) with no luck.  Maybe this 
is a good opportunity for me to learn some Python debugging tools.

Thanks!
--Matt

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Copying a ZipExtFile

2009-10-29 Thread Moore, Mathew L
> On October 28, 2009 8:33 PM, "ryles" wrote:
>

> > with io.BytesIO() as memio:
> > shutil.copyfileobj(f, memio)
> > zip = zipfile.ZipFile(file=memio)
> > # Can't use zip.extract(), because I want to ignore paths
> > # within archive.
> > src = zip.open('unknowndir/src.txt')
> > with open('dst.txt', mode='wb') as dst:
> > shutil.copyfileobj(src, dst)
> >
> > The last line throws an Error:
> >
> > Traceback (most recent call last):
> >   File "test.py", line 25, in 
> > shutil.copyfileobj(src, dst)
> >   File "C:\Python26\lib\shutil.py", line 27, in copyfileobj
> > buf = fsrc.read(length)
> >   File "C:\Python26\lib\zipfile.py", line 594, in read
> > bytes = self.fileobj.read(bytesToRead)
> > TypeError: integer argument expected, got 'long'
> 
> It should hopefully work if you use cStringIO/StringIO instead of
> BytesIO.
>

It does! Excellent!  You've saved me the trouble of a weekend debug session.

--Matt

-- 
http://mail.python.org/mailman/listinfo/python-list