Re: [python-win32] Python Excel - 2 workbooks affect each other[SEC=UNCLASSIFIED]

2011-03-02 Thread Stefanie Lück
Hello!

 

Thanks for the answers and pointing me to paste/copy references of Excel! I
solved the problem by adding self.xlApp.CutCopyMode = False into my excel
code just after I call self.xlApp = Dispatch ('Excel.Application').

 

I still don’t know how Excel keep the reference from coping data into
another program, save the data from the clipboard in a text (!) file,
writing the proceeded data from a text file into a new created Excel
workbook…But anyway, I solved it :-)

 

Thanks and kind regards,

Stefanie

 

  _  

Von: python-win32-bounces+lueck=ipk-gatersleben...@python.org
[mailto:python-win32-bounces+lueck=ipk-gatersleben...@python.org] Im Auftrag
von Andrew MacIntyre
Gesendet: Dienstag, 1. März 2011 01:15
An: python-win32@python.org
Betreff: Re: [python-win32] Python Excel - 2 workbooks affect each
other[SEC=UNCLASSIFIED]

 

[apologies for top post]

 

I’m far from an expert, or even experienced, in Excel however the term
“paste” rings bells.  Behind the scenes, material in the clipboard has lots
of metadata and a selection copied from one open workbook includes the
references to that workbook so when you paste it Excel includes those
references and effectively links the pasted to cells to the pasted from
cells.  If you must use paste, then you will probably need to use “paste
special” and select “values” – this should break the references back to the
original source.

 

If you carefully look at the “formula” of a pasted cell, you might see how
the source workbook  worksheet are identified – I know that this sort of
thing is visible when using the “function wizard” with such Excel functions
as VLOOKUP.

 

- These thoughts are mine alone! -

Andrew MacIntyre   Operations Branch

tel:   +61 2 6219 5356 Communications Infrastructure Division

fax:   +61 2 6253 3277 Australian Communications  Media Authority

email: andrew.macint...@acma.gov.auhttp://www.acma.gov.au/

 

From: python-win32-bounces+andrew.macintyre=acma.gov...@python.org
[mailto:python-win32-bounces+andrew.macintyre=acma.gov...@python.org] On
Behalf Of Stefanie Lück
Sent: Tuesday, 1 March 2011 1:19 AM
To: python-win32@python.org
Subject: [python-win32] Python Excel - 2 workbooks affect each other

 

Hello!

 

I have a strange excel behaviour if 2 workbooks are open. I’m trying to
create an excel workbook with a bar chart from some data which comes from my
wxPython program. If I paste the data into my program from any source except
another excel file, everything works as expected. But if I copy the values
from a source excel workbook into my program and then try to create a new
excel workbook with a chart, the new workbook takes the data of the chart
from the source workbook and not from the sheet I specified. This happens
only if the data of the source workbook are still selected from the copy
before, if I click into another cell, my new created workbook will use the
data of its sheet which I specified.

 

Does anybody know what this could be? In my code I clearly specify to use
the data of my new created worksheet. The name of the source workbook sheet
is completely different. Looks like excel ignore it and use the currently
selected data of any workbook. Is there a way to specify the Workbook and
Worksheet, which I want to use? 

 

Any help would be appreciated!

Thanks,

Stefanie

NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all

copies of the original message. 

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Problem with msvcr90.dll

2011-03-02 Thread Aahz
On Tue, Feb 01, 2011, Tefnet Developers wrote:

 $ make pytest.exe
 i586-mingw32msvc-gcc -I./include -I./include/python -Wall -pedantic
 -std=c99-c -o pytest.o pytest.c
 i586-mingw32msvc-gcc -L./lib -o pytest.exe pytest.o -lmingw32 -lpython26
 rm pytest.o
 
 The output looks like this:
 
 C:\pytest
 Traceback (most recent call last):
   File string, line 3, in module
   File C:\Python26\lib\site-packages\win32\lib\pywintypes.py, line
 124, in module
 __import_pywin32_system_module__(pywintypes, globals())
   File C:\Python26\lib\site-packages\win32\lib\pywintypes.py, line 64,
 in __import_pywin32_system_module__
 import _win32sysloader
 ImportError: DLL load failed: The specified module could not be found

What happens if you use VC++ 2008 Express?  (Yes, that should not
change anything, but I've seen people report all kinds of weird problems
with mingw.)
-- 
Aahz (a...@pythoncraft.com)   * http://www.pythoncraft.com/

Programming language design is not a rational science. Most reasoning
about it is at best rationalization of gut feelings, and at worst plain
wrong.  --GvR, python-ideas, 2009-03-01
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Problem with msvcr90.dll

2011-03-02 Thread Mark Hammond

On 2/02/2011 3:11 AM, Tefnet Developers wrote:

Dnia 2011-02-01, wto o godzinie 10:44 +1100, Mark Hammond pisze:

This stuff is painful and poorly documented.  Is it possible the code
which triggers the failing import is on a different thread than the one
which loaded Python?  If so, I suspect the magic done by Python in
dl_nt.c may not be kicking in, which is supposed to ensure all python
modules are loaded using the activation context defined by pythonxx.dll.


The smallest piece of program that shows the problem:

$ cat pytest.c
#includePython.h


int main(void) {
 Py_Initialize();
 PyRun_SimpleString(
 import traceback \n
 try:\n
import pywintypes\n
 except:\n
traceback.print_exc()\n
 );
}

$ make pytest.exe
i586-mingw32msvc-gcc -I./include -I./include/python -Wall -pedantic
-std=c99-c -o pytest.o pytest.c

i586-mingw32msvc-gcc -L./lib -o pytest.exe pytest.o -lmingw32 -lpython26
rm pytest.o


What happens if you give that executable a manifest referencing the CRT? 
 Note that things changed since pywin32 build 214 - now (almost) none 
of the pywin32 pyd files have a manifest at all, meaning they can be 
loaded correctly by Python itself in all cases - but the thing that 
loads Python *must* have a manifest - ie, python.exe needs (and has) 
one, as does the DLL which loads Python COM objects.  It gets even more 
complicated if Python is loaded via LoadLibrary - you can check the 
source to pythoncomloader in the pywin32 repo for more details (the 
short version is that the same hacks that Python itself does WRT 
activation contexts needs to be done...)


Aahz's suggestion is a good one - you should use the VC compiler as your 
baseline, then try and get mingw going one you have initial success 
with VC.


HTH,

Mark
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Problem with msvcr90.dll

2011-03-02 Thread Tim Roberts
Mark Hammond wrote:

 What happens if you give that executable a manifest referencing the CRT? 
  Note that things changed since pywin32 build 214 - now (almost) none 
 of the pywin32 pyd files have a manifest at all, meaning they can be 
 loaded correctly by Python itself in all cases - but the thing that 
 loads Python *must* have a manifest - ie, python.exe needs (and has) 
 one, as does the DLL which loads Python COM objects.  It gets even more 
 complicated if Python is loaded via LoadLibrary - you can check the 
 source to pythoncomloader in the pywin32 repo for more details (the 
 short version is that the same hacks that Python itself does WRT 
 activation contexts needs to be done...)

Let us HOPE that Python quickly migrates to Visual Studio 2010, in which
the team has wisely decided to abandon the side-by-side stuff altogether
and go back to a simpler way of life, where having the files in
\Windows\System32 is enough for everyone.

-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Possible trouble with pywin23-216 on python 3.2

2011-03-02 Thread Vernon Cole
Attempting to install using the binary installer, the installer gets to
postinstall script finished, but the display window says:
v v v v v v v v
Copied pythoncom32.dll to C:\Windows\system32\pythoncom32.dll
Copied pythoncomloader32.dll to C:\Windows\system32\pythoncomloader32.dll
Copied pywintypes32.dll to C:\Windows\system32\pywintypes32.dll
FAILED to register the Python COM objects
- Software\Python\PythonCore\3.2\Help[None]=None
- Software\Python\PythonCore\3.2\Help\Pythonwin
Reference[None]='C:\\Python32\\Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
Traceback (most recent call last):
  File string, line 372, in install
  File string, line 170, in RegisterCOMObjects
  File C:\Python32\lib\site-packages\win32com\server\register.py, line 47
except win32api.error, (code, fn, msg):
 ^
SyntaxError: invalid syntax
Traceback (most recent call last):
  File string, line 604, in module
  File string, line 471, in install
  File C:\Python32\lib\site-packages\win32com\client\__init__.py, line 424
except pythoncom.com_error, details:
  ^
SyntaxError: invalid syntax
^ ^ ^ ^ ^ ^

When the adodbapi test is run, it gives:
v v v v v v
C:\hg\adodbapi\testP3kc:\python32\python.exe testadodbapi.py
Traceback (most recent call last):
  File testadodbapi.py, line 28, in module
import win32com.client
  File c:\python32\lib\site-packages\win32com\client\__init__.py, line 424
except pythoncom.com_error, details:
  ^
SyntaxError: invalid syntax
^ ^ ^ ^ ^ ^ ^ ^ ^
Which sounds oddly familiar.
This is on Windows Vista Home Basic.
--
Vernon
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Possible trouble with pywin23-216 on python 3.2

2011-03-02 Thread Mark Hammond

On 3/03/2011 4:15 PM, Vernon Cole wrote:

Attempting to install using the binary installer, the installer gets to
postinstall script finished, but the display window says:
v v v v v v v v
Copied pythoncom32.dll to C:\Windows\system32\pythoncom32.dll
Copied pythoncomloader32.dll to C:\Windows\system32\pythoncomloader32.dll
Copied pywintypes32.dll to C:\Windows\system32\pywintypes32.dll
FAILED to register the Python COM objects
- Software\Python\PythonCore\3.2\Help[None]=None
- Software\Python\PythonCore\3.2\Help\Pythonwin
Reference[None]='C:\\Python32\\Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
Traceback (most recent call last):
   File string, line 372, in install
   File string, line 170, in RegisterCOMObjects
   File C:\Python32\lib\site-packages\win32com\server\register.py, line 47
 except win32api.error, (code, fn, msg):
  ^
SyntaxError: invalid syntax
Traceback (most recent call last):
   File string, line 604, in module
   File string, line 471, in install
   File C:\Python32\lib\site-packages\win32com\client\__init__.py,
line 424
 except pythoncom.com_error, details:
   ^
SyntaxError: invalid syntax
^ ^ ^ ^ ^ ^

When the adodbapi test is run, it gives:
v v v v v v
C:\hg\adodbapi\testP3kc:\python32\python.exe testadodbapi.py
Traceback (most recent call last):
   File testadodbapi.py, line 28, in module
 import win32com.client
   File c:\python32\lib\site-packages\win32com\client\__init__.py,
line 424
 except pythoncom.com_error, details:
   ^
SyntaxError: invalid syntax
^ ^ ^ ^ ^ ^ ^ ^ ^
Which sounds oddly familiar.
This is on Windows Vista Home Basic.


*sob* - I tested 3.2 with a 64bit build and didn't perform a test 
install of the 3.2 32bit exe.  The 64bit one is fine and I don't 
understand how that could have happened - in theory the 2 builds share 
the same .py files - but it has happened :(


I'll check 3.1 tomorrow and try to determine what went wrong in the 
build process, then put up new builds where necessary...


Thanks,

Mark
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32