Comments (4)
Which line in which source file is throwing the error? Can you post the full traceback?
from pyx12.
@victor-roy
ERROR Failed to create 999 response
Traceback (most recent call last):
File "c:\python\python37-32\lib\site-packages\pyx12\x12n_document.py", line 252, in x12n_document
errh.accept(visit_999)
File "c:\python\python37-32\lib\site-packages\pyx12\error_handler.py", line 101, in accept
visitor.visit_root_pre(self)
File "c:\python\python37-32\lib\site-packages\pyx12\error_999.py", line 83, in visit_root_pre
self.wr.Write(isa_seg)
File "c:\python\python37-32\lib\site-packages\pyx12\x12file.py", line 495, in Write
self._write_isa_segment(seg_data)
File "c:\python\python37-32\lib\site-packages\pyx12\x12file.py", line 582, in _write_isa_segment
self.fd_out.write(out)
File "C:\Python\Python37-32\Lib\tempfile.py", line 481, in func_wrapper
return func(*args, **kwargs)
TypeError: a bytes-like object is required, not 'str'
from pyx12.
Using Python3 v3.8.5 on Windows... when running x12valid.py (v2.3.3) specifically, down stack in x12file.py, any line with:
self.fd_out.write(out)
results in "TypeError: a bytes-like object is required, not 'str'".
Hack to force self.fd_out.write(bytes(out, encoding='ascii'))
opens up a can of worms in downstream processing as there is bytes to string conversion needed if the hack is applied - so that is not the simple fix.
I am still debugging - but I assume that wherever x12valid.py code calls x12file.X12Writer - the "src_file_obj" needs to have the correct mode as tempfile._TemporaryFileWrapper. If anyone who knows the code base better can suggest the quick fix, I can try it and apply and do a pull request. Otherwise, given extra time (aka boredeom) and/or an urgent need to get x12valid working - hopefully can figure it out.
from pyx12.
@azoner, @victor-roy , @jasirmuhammad
In x12valid.py, making this change:
- fd_997 = tempfile.TemporaryFile()
+ fd_997 = tempfile.TemporaryFile(mode='r+')
seems to work.
from pyx12.
Related Issues (20)
- JSON error and parsing output HOT 2
- Convert from setuptools resource loading to pkgtools HOT 2
- x12xml_idtag.py location or is it deprecated?
- x12xml crashing in dataele.py
- Help - Parse EDI file into XML HOT 2
- XML map for 837D claim HOT 2
- pyx12 usage issue HOT 1
- Tabs not being treated as invalid
- Add map file for 5010 279A1
- 834 5010 LX sequence # collisions? HOT 4
- Error when parsing a 271 file HOT 1
- Help - Parse data in multiple files (not really an issue, a question) HOT 1
- 835 - missing Adjustment Reason Code HOT 5
- Feature Request: Remove validation of external defined code sets HOT 4
- Error parsing 277 file HOT 1
- can it convert to a tabular data format excel or tab delimited file ? HOT 1
- x12valid throwing TypeError: 'NoneType' object is not iterable
- Is this project alive or dead? HOT 1
- Can we please update the pyx12/map/codes.xml
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 pyx12.