joshman108
Active Member
- Joined
- Jul 6, 2016
- Messages
- 310
This may be a python question, not sure. I am using the following vba code to create and save a new workbook with information from the first.
That creates a prompt for the user to save the file, select the file type and file name. When the user hits "save" it closes the prompt and continue with macro. Everything seems to be fine until I try uploading the file into our database via a python script. The following error message appears:
Here is the error given by python
Also, when I then go to open said file on my computer which contains NULL bytes, excel gives me this message:
Any ideas what's happening here? I am struggling to find much online.
Version 15.39 for mac.</module>
Rich (BB code):
Range("u3", Range("u3").End(xlToLeft).End(xlDown)).Copy ' copy some data from open workbook
Set dealbook = Workbooks.Add 'set new workbook
dealbook.Worksheets("sheet1").Cells.NumberFormat = "@" 'format new workbook as text
dealbook.Worksheets("sheet1").Range("a1").PasteSpecial Paste:=xlPasteValues 'paste as values into new workbook
Do
dName = Application.GetSaveAsFilename 'save the file
Loop Until dName <> False
dealbook.SaveAs Filename:=dName
That creates a prompt for the user to save the file, select the file type and file name. When the user hits "save" it closes the prompt and continue with macro. Everything seems to be fine until I try uploading the file into our database via a python script. The following error message appears:
Here is the error given by python
Rich (BB code):
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo}span.s1 {font-variant-ligatures: no-common-ligatures}</style>Traceback (most recent call last):
File "./log.py", line 37, in <module>
rows = list(reader)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 107, in next
self.fieldnames
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 90, in fieldnames
self._fieldnames = self.reader.next()
_csv.Error: line contains NULL byte
Also, when I then go to open said file on my computer which contains NULL bytes, excel gives me this message:
Rich (BB code):
The file format and extension of 'rev backfills.csv' don't match. The file could be corrupted or unsafe.
Unless you trust its source, don't open it. Do you want to open it anyway?
Any ideas what's happening here? I am struggling to find much online.
Version 15.39 for mac.</module>
Last edited: