Comments (4)
This seems to only affect Python 2; I can print this file from Python 3 fine (well, except on Windows, where it can't print because of the combining diacritic in question not being in cp-1252...)
When loading from a file, instead of with zoom, I get:
Traceback (most recent call last):
File "unicodetest.py", line 6, in
print(record)
File "/private/tmp/venv/lib/python2.7/site-packages/pymarc/record.py", line 84, in str
text_list.extend([str(field) for field in self.fields])
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0301' in position 1025: ordinal not in range(128)
(note, my error mentions the codepoint for the combining diacritic; OP's is for composed é instead -- not sure why this would differ, unless the Z39.50 endpoint has a different record than what LoC gives me to download).
I assume the use of 1-argument str() on a unicode is to blame here. In any event calling str() directly in a codebase that runs on 2 and 3 is a code smell; should be using six.text_type probably.
from pymarc.
Interesting. I had not tried replicating the problem or running the test script with Python 3. Unfortunately, I need to stay with Python 2.7.x, for now, but it's good to know that moving to Python 3 might remedy a few issues. Thanks Wooble.
from pymarc.
I applied the changes from the diff and am no longer experiencing the error. Thanks for your help, Wooble. Much appreciated.
from pymarc.
This was just released as part of v3.1.4. Thanks for identifying the problem and fixing it!
from pymarc.
Related Issues (20)
- Add encoding option to marcxml.record_to_xml HOT 4
- field .indicators, indicator1, indicator2 confusion HOT 3
- Make leader mutable? HOT 14
- A permissive MARCReader HOT 4
- MARCReader obscure warning: couldn't find 0xa0 in g0=66 g1=69 HOT 11
- YAZ - collecting data and printing them with PYMARC HOT 1
- Convert README to PyPI description? HOT 3
- How to analyze the bad.dat HOT 1
- New release to PyPI to make Python 3 support official? HOT 2
- Corrupt / Incompatible data: couldn't find 0x20 in g0=83 g1=69 HOT 1
- Add subfields at an arbitrary position HOT 2
- Document use of MARCXML with an example HOT 5
- Correct the readme to avoid new errors HOT 1
- License HOT 8
- Tests fail on python 3.8
- v4.0.0? HOT 25
- Linting
- Python3 HOT 4
- License HOT 1
- Organization account? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymarc.