Comments (5)
Hmmm, I have # -*- coding: utf-8 -*-
specified in all executable Python files, is there another way to specify the encoding so Windows doesn't fail?
from fhir-parser.
Unfortunately, that coding refers to the python file's text encoding, not to the default encoding used to read or write text files. So, that allows unicode variable names, unicode comments, etc.
Sorry I wasn't clear enough above. You need to specify encoding when you open text files, by specifying the encoding kw argument.
example:
with file as open(path, 'r', encoding='utf-8'):
...
It's kind of idiomatic to do so when you want your code to run without fail under windows. So, I do it always, just as a matter of course. It's an unfortunate platform cross compatibility issue that bites a lot of folks and should be mentioned in any text the describes the use of os.path. But it often isn't.
from fhir-parser.
Ah I see. I use io.open
with specified encoding for writing the classes, will apply to reading as well. I have no access to a Windows machine so I'll let you re-open the issue when I close it and it's still giving you headaches.
from fhir-parser.
One last comment on the opening of files: io.open() is an alias for the builtin open() There's no need to import io for most file access and processing.
from fhir-parser.
Yes. I like to use io.open
to contrast with codecs.open
when I specify the encoding (i.e. write more thorough code). More a useless habit than anything really.
from fhir-parser.
Related Issues (20)
- Outdated default python settings? HOT 1
- OperationOutcome? HOT 4
- fhir-parser rendering some strange ASCII... HOT 5
- Support for Extensions HOT 1
- Element ordering HOT 1
- More unit tests needed HOT 1
- Identifier type doesn't check valid characters
- Date/time format incorrect HOT 1
- Need full implementation of FHIR data types HOT 1
- Question about unit tests HOT 1
- Need warning if cache doesn't match source
- generate.py fails to download FHIR specs file HOT 1
- support for python3 type system
- Unable to run generate.py without error HOT 1
- Valueset elementProperties of the form "Foo.str"
- Enable Travis repo HOT 3
- Help Need : Step by Step guide for beginner
- Can't locate Sample files
- validation? HOT 9
- No LICENSE file in the repository HOT 3
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 fhir-parser.