这是我的spec文件
<script type="text/javascript" language="javascript" class="init">
/* Formatting function for row details - modify as you need */
function format ( d ) {
// `d` is the original data object for the row
return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">'+
'<tr>'+
'<td>Full name:</td>'+
'<td>'+d.name+'</td>'+
'</tr>'+
'<tr>'+
'<td>Extension number:</td>'+
'<td>'+d.extn+'</td>'+
'</tr>'+
'<tr>'+
'<td>Extra info:</td>'+
'<td>And any further details here (images etc)...</td>'+
'</tr>'+
'</table>';
}
$(document).ready(function() {
var table_data_json = '[<?php for($i=0;$i<5;$i++){?>{"name":"Tiger Nixon","position":"System Architect","salary":"$320,800","start_date":"2011/04/25","office":"Edinburgh","extn":"5421"},<?php }?>{"name":"Garrett Winters","position":"Accountant","salary":"$170,750","start_date":"2011/07/25","office":"Tokyo","extn":"8422"},{"name":"Ashton Cox","position":"Junior Technical Author","salary":"$86,000","start_date":"2009/01/12","office":"San Francisco","extn":"1562"}]';
var table = $('#example').DataTable( {
"data": JSON.parse(table_data_json),
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "salary" }
],
"order": [[1, 'asc']],
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Export to Spreadsheet",
"mColumns": "visible",
"oSelectorOpts": { filter: 'applied', order: 'current' },
"bFooter":false
}
],
"oSelectorOpts": {
"filter": "applied"
}
},
initComplete: function () {
var r = $('#example tfoot tr');
r.find('th').each(function(){
$(this).css('padding', 8);
});
$('#example thead').append(r);
$('#search_0').css('text-align', 'center');
this.api().columns([1,7]).every( function () {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
} );
// Add event listener for opening and closing details
$('#example tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
} );
</script>
我修改了它以包含所需的文本文件。我正在使用以下命令运行它
# -*- mode: python -*-
a = Analysis(['final_code.py'],
pathex=['C:\\Python27\\PyInstaller-2.1\\final_code'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
Tree('C:\\Python27\\data_req\\'),
a.scripts,
exclude_binaries=True,
name='final_code.exe',
debug=False,
strip=None,
upx=True,
console=False )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name='final_code')
在我的命令提示符下。
我得到的错误是
pyinstaller.py final_code.spec
答案 0 :(得分:6)
当我使用&#34; \\&#34;时,我遇到了类似的错误在Windows系统上的路径。 如下所示:
a = Analysis(['final_code.py'],
pathex=['C:\\Python27\\PyInstaller-2.1\\final_code'],
....
exe = EXE(pyz,
Tree('C:\\Python27\\data_req\\'),
...
而不是pathex=['C:/Python27/PyInstaller-2.1/final_code']
和Tree('C:/Python27/data_req/')
。
我遇到了类似的问题。我相信它的类型为斜线&#34; /&#34;,&#34; \&#34;。
当我有如下代码时:
py_compile.compile('E:\\python_coe\\PythonInput.py','wb')
当我改为py_compile.compile('E:/python_coe/PythonInput.py','wb')
时,我遇到了类似的错误。
答案 1 :(得分:0)
对我来说,第一次调整是有效的。