473,670 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

extending Python error

hi!

I have a c++ file that does some XML processing (visual c++ using ATL). The
file builds fine. However when i add the header #include<Python .h>, i get a
number of errors
C:\Windows CE Tools\wce300\Po cket PC 2002\atl\includ e\atlbase.h(539 5) :
error C2664: '__WinCE_Output DebugStringA' : cannot convert parameter 1
from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast
C:\Windows CE Tools\wce300\Po cket PC 2002\atl\includ e\atlbase.h(539 6) :
error C2664: '__WinCE_Output DebugStringA' : cannot convert parameter 1
from 'unsigned short [4]' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast

any ideas where the errors are coming from?

thanks

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Jul 18 '05 #1
3 1894
Ajay wrote:
C:\Windows CE Tools\wce300\Po cket PC 2002\atl\includ e\atlbase.h(539 5) :
error C2664: '__WinCE_Output DebugStringA' : cannot convert parameter 1
from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast [...]
any ideas where the errors are coming from?


Could it be that WCHAR_T is not unsigned short on Windows CE?

Regards,
Martin
Jul 18 '05 #2
well the problem is:
i am trying to do some xml processing on the PDA. i plan to do it in C++
using msxml and then provide a Python wrapper around it.
the code below just loads up a simple XML file and parses it.
#include <Python.h>
#include <windows.h>
#include <msxml.h>
#include <atlbase.h>
#include <afx.h>
#include <afxdisp.h>

void LoadXML(CString sFilePath)
{
CComPtr<IXMLDOM Document> pXMLDoc;
pXMLDoc.CoCreat eInstance(__uui dof(DOMDocument ));
COleVariant vXmlFile(sFileP ath);
VARIANT_BOOL vSuccess;

HRESULT hr = pXMLDoc.CoCreat eInstance(__uui dof (DOMDocument));
pXMLDoc->put_validateOn Parse(VARIANT_F ALSE);
pXMLDoc->put_resolveExt ernals(VARIANT_ FALSE);
pXMLDoc->put_preserveWh iteSpace(VARIAN T_FALSE);
hr = pXMLDoc->load(vXmlFile, &vSuccess);
}

this works perfectly fine until i include the Python.h header at which
moment i get a whole list of errors. the errors are raised in atlbase.h
and are all the same
C:\Windows CE Tools\wce300\Po cket PC 2002\atl\includ e\atlbase.h(539 5) :
error C2664: '__WinCE_Output DebugStringA' : cannot convert parameter 1
from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast
C:\Windows CE Tools\wce300\Po cket PC 2002\atl\includ e\atlbase.h(539 6) :
error C2664: '__WinCE_Output DebugStringA' : cannot convert parameter 1
from 'unsigned short [4]' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast

i think there is something that needs to be changed in Python.h for this to
work but have no idea what it is.

cheers
Quoting "\"Martin v. Löwis\"" <ma****@v.loewi s.de>:
Ajay wrote:
i think that might be it. what would i need to change in Python.h to

remove
the errors?


I don't know. We would need to understand the problem in detail first.

Martin

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Jul 18 '05 #3
Ajay wrote:
C:\Windows CE Tools\wce300\Po cket PC 2002\atl\includ e\atlbase.h(539 5) :
error C2664: '__WinCE_Output DebugStringA' : cannot convert parameter 1
from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cas t, C-style cast or function-style cast


So what is line 5395 of atlbase.h?

Regards,
Martin
Jul 18 '05 #4

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

Similar topics

4
2776
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been working with Python for a year or more now, but only doing simple extending in C/C++. I'm now attempting some embedding and several questions have come to mind. BTW - I'm running Windows 2000 with Python23 and VisualC++ developers
0
1734
by: Hugh Macdonald | last post by:
I've got a slight problem... and I'm stuck as to where to go with it... I'm running on Redhat7.2, using Python 2.2.2 I've got a compiled module that I wrote almost a year ago - it works fine, and I've never had any problems with it... I also did an extension to a plugin (Shake) using Python, so the plugin loads a python module and calls various functions in there.... all in all, fine - I thought I had my head around the system, and...
3
13495
by: ch424 | last post by:
Hi there, I'm using Python 2.4.1 on Ubuntu Linux, and I'm having problems extending python in C: The C code is below: #include <Python.h> #include "ni488.h"
1
1719
by: Richard Townsend | last post by:
In the "Extending and Embedding" part of the Python documentation: section 5.4 "Extending Embedded Python" - it describes how to use a Python extension module from Python that is embedded in a C application. Is it safe to call Py_InitModule() more than once in the same application - in order to be able to use more than one extension module? -- Richard
3
2045
by: Marco Meoni | last post by:
Hi all! I've a problem with a C++ class that has to be included in a python application. One way to do it is Extending and Embedding the Python Interpreter Now i have 2 questions 1) Is there a one-file version of this tutorial? 2) Is there anyone that can help me with this problem? The class is attached. Thanks all. Marco
5
3824
by: vbgunz | last post by:
Hello everyone. I own two books. Learning Python and Python in a nutshell. When cross referencing the two books to try and clarify the ideas behind extending methods and delegates, this is where confusion veered it's ugly head :( Learning Python explains on page 324: Class Interface Techniques (21.3.3 in the ebook) the following is an extender method. ''' #################################### '''
1
1855
by: jeremito | last post by:
I am trying to learn how to extend and/or embed Python. I have looked at the document "Extending and Embedding the Python Interpreter" and also "Python/C API Reference Manual. In the examples shown in "Extending..." there are some things I ma not familiar with so I turn to the index in the Reference Manual, but they are not listed. For example, PyEval_CallObject and PyDict_GetAttrString. My question is this: Is the documentation out of...
0
1562
by: vishnu | last post by:
Hello All, I have embedded python 2.5 in to my C application. As we need the python scripts to run in multi threaded environment I have used Py_NewInterpreter() and Py_EndInterpreter each time I execute a run script function. The code is as follows: RunScript(char *pScriptName,char *pFuncName,...) { PyEval_AcquireLock()
7
3383
by: Maximus Decimus | last post by:
HI all, I am using python v2.5 and I am an amateur working on python. I am extending python for my research work and would like some help and guidance w.r.t this matter from you experienced python developers. II want to add some more KEYWORDS and DATATYPES into the python script apart from the existing ones. It would be really great if anybody could guide me as which files and
0
2107
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via callback.setHandler1(callback1) this only seems to affect pythons ability to trigger an "event" in c. PyObject *Handler is always NULL even after I call Register_Handler(...). I thought there was some magic here that was assigning the pointer *Handler to my python...
0
8384
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
8901
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
8813
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...
0
7412
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6212
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1791
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.