473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Changing Unicode object to Tuple Type

Can we have change a unicode string Type object to a Tuple type
object.. If so how ????

May 24 '07 #1
4 2229
la**************@gmail.com schrieb:
Can we have change a unicode string Type object to a Tuple type
object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?

Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.

diez
May 24 '07 #2
On May 24, 5:11 pm, "Diez B. Roggisch" <d...@nospam.web.dewrote:
laxmikiran.ba...@gmail.com schrieb:
Can we have change a unicode string Type object to a Tuple type
object.. If so how ????

Why? Are you getting an error that makes you think that's a good idea?

Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.

diez
**********

I have to get few strings from an application(strings of different
languages..ex: korean,japanese,french etc.,). The data returned by the
application was in the format of the xml.
Hence I was using pyRXP to get the data. I was not able to get all the
strigs in different languages. Now I wanted to use pyRXPU to get all
the strings of that application.When Iam using pyRXPU iam getting the
following error.

Traceback (most recent call last):
File "D:\LanguageScripts\Screens.py", line 106, in
test_1_01_DoSomething
TitlenSoftkeyfn()
File "D:\LanguageScripts\EventLog_Screens.py", line 66, in
TitlenSoftkeyfn
titleBar = root.TitleBar.currentText
File "D:\LanguageScripts\XmlWrapper.py", line 35, in __getattr__
tagName, attrs, children, spare = child
ValueError: need more than 1 value to unpack
Here the child is of the format unicode..

When pyRXP is used it was of the format tuple... I was just trying to
find out if there is some way that I make this code work.

May 24 '07 #3
la**************@gmail.com schrieb:
On May 24, 5:11 pm, "Diez B. Roggisch" <d...@nospam.web.dewrote:
>laxmikiran.ba...@gmail.com schrieb:
>>Can we have change a unicode string Type object to a Tuple type
object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?

Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.

diez

**********

I have to get few strings from an application(strings of different
languages..ex: korean,japanese,french etc.,). The data returned by the
application was in the format of the xml.
Hence I was using pyRXP to get the data. I was not able to get all the
strigs in different languages. Now I wanted to use pyRXPU to get all
the strings of that application.When Iam using pyRXPU iam getting the
following error.

Traceback (most recent call last):
File "D:\LanguageScripts\Screens.py", line 106, in
test_1_01_DoSomething
TitlenSoftkeyfn()
File "D:\LanguageScripts\EventLog_Screens.py", line 66, in
TitlenSoftkeyfn
titleBar = root.TitleBar.currentText
File "D:\LanguageScripts\XmlWrapper.py", line 35, in __getattr__
tagName, attrs, children, spare = child
ValueError: need more than 1 value to unpack
Here the child is of the format unicode..

When pyRXP is used it was of the format tuple... I was just trying to
find out if there is some way that I make this code work.
I don't know pyRXP and pyRXPU, and especially not how you use them.
Who's responsible for writing that "XmlWrapper.py"? He or she obviously
expected a tuple returned that was basically a DOM-tree (tag, attrs,
childs and something called spare)

But changing to pyRXPU seems to break the protocol here. But I can't
judge that without seeing more code.

diez
May 24 '07 #4
On May 24, 11:19 pm, "Diez B. Roggisch" <d...@nospam.web.dewrote:
laxmikiran.ba...@gmail.com schrieb:
On May 24, 5:11 pm, "Diez B. Roggisch" <d...@nospam.web.dewrote:
laxmikiran.ba...@gmail.com schrieb:
>Can we have change a unicode string Type object to a Tuple type
object.. If so how ????
Why? Are you getting an error that makes you think that's a good idea?
Tuples are basically structs, unicode objects are strings. There is no
canonical way to convert them. Tell us more about the problem you want
to be solved, and we might help you better.
diez
**********
I have to get few strings from an application(strings of different
languages..ex: korean,japanese,french etc.,). The data returned by the
application was in the format of the xml.
Hence I was using pyRXP to get the data. I was not able to get all the
strigs in different languages. Now I wanted to use pyRXPU to get all
the strings of that application.When Iam using pyRXPU iam getting the
following error.
Traceback (most recent call last):
File "D:\LanguageScripts\Screens.py", line 106, in
test_1_01_DoSomething
TitlenSoftkeyfn()
File "D:\LanguageScripts\EventLog_Screens.py", line 66, in
TitlenSoftkeyfn
titleBar = root.TitleBar.currentText
File "D:\LanguageScripts\XmlWrapper.py", line 35, in __getattr__
tagName, attrs, children, spare = child
ValueError: need more than 1 value to unpack
Here the child is of the format unicode..
When pyRXP is used it was of the format tuple... I was just trying to
find out if there is some way that I make this code work.

I don't know pyRXP and pyRXPU, and especially not how you use them.
Who's responsible for writing that "XmlWrapper.py"? He or she obviously
expected a tuple returned that was basically a DOM-tree (tag, attrs,
childs and something called spare)

But changing to pyRXPU seems to break the protocol here. But I can't
judge that without seeing more code.
Looks like the OP needs to RTFM. Here's an excerpt from an article by
David Mertz (http://www.ibm.com/developerworks/library/x-
matters29.html):
"""
pyRXP's tuple tree data structure

pyRXP (and RXP itself) uses an efficient, lightweight tree
representation of XML documents. Each node in a pyRXP tree is simply a
tuple of the form:

(tagname, attr_dict, child_list, reserved)
No specialized Python classes are used in the representation -- just
tuples, dicts, lists, and strings (and None in the reserved position).
Perhaps surprisingly, this form is adequate to represent all the
information in an XML document. The tagname is a straightforward
string; the attribute dictionary is a dictionary that maps attributes
to values, as you would expect. ***The child list is more subtle:
Strings can be interleaved with tuples in the list, indicating a mixed
content element.*** Moreover, an element that has no content is
represented by an empty child list, but a self-closed tag is
represented by None.
"""

"subtle" is not the word I would have used :-)

May 24 '07 #5

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

Similar topics

15
by: oom | last post by:
I am a bit of a newbie when it comes to python, when working with lists today I noticed some very odd behaviour, any suggestions welcome: Python 2.2.3 (#1, Nov 6 2003, 14:12:38) on linux2...
12
by: manstey | last post by:
I am writing a program to translate a list of ascii letters into a different language that requires unicode encoding. This is what I have done so far: 1. I have # -*- coding: UTF-8 -*- as my...
14
by: Dennis Benzinger | last post by:
Hi! The following program in an UTF-8 encoded file: # -*- coding: UTF-8 -*- FIELDS = ("Fächer", ) FROZEN_FIELDS = frozenset(FIELDS) FIELDS_SET = set(FIELDS)
5
by: Jon Bowlas | last post by:
Hi listers, I wrote this script in Zope some time ago and it worked for a while, but now I'm getting the following error: TypeError: coercing to Unicode: need string or buffer, NoneType found ...
9
by: Jim | last post by:
Hello, I'm trying to write exception-handling code that is OK in the presence of unicode error messages. I seem to have gotten all mixed up and I'd appreciate any un-mixing that anyone can...
9
by: Gerry | last post by:
I'm using pyExcelerator and xlrd to read and write data from and to two spreadsheets. I created the "read" spreadsheet by importing a text file - and I had no unicode aspirations. When I read...
0
by: pythonuser | last post by:
Can we change a unicode object to a object of tuple type...
2
by: laxmikiran.bachu | last post by:
Can we have change a unicode string Type object to a Tuple type object.. If so how ????
8
by: hidrkannan | last post by:
I am reading a set of data from the excel workbook. Data are contained in 2 columns. Column A contains the names and Column B contains values. The issue is the value can be of any type integer,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.