2013-08-16 37 views
7

ben olan her kareyi ile (küçük değişikliklerle) aynı komutu çalıştırmak için, bu kodu çalıştırmak çalışıyorum:TypeError: değil str null byte olmadan dize olmalıdır

traj.reset() 
import os 
#os.chdir(outname) 
for i, frame in enumerate(traj): 
    frame.superpose() 
    comando = "python hollow.py -c constraint -o hollow_%s.pdb urei%s.pdb" % (i, i) 
    os.system(comando) 
    pml_cmd = "pymol urei%s.pdb hollow_%s.pdb -c -d 'as cartoon, urei%s;color gray90, urei%s;center chain A;set_view (\-0.605158150,0.089404292,0.791067421,\0.795849979,0.093013920,0.598304033,\-0.020089993,0.991641700,-0.127439827,\0.000000000,0.000000000,-202.017959595,\-28.771762848,-7.683309555,10.745590210,\-568.485290527,972.520690918,-20.000000000);bg white;as sphere, hollow_%s;color cyan, hollow_%s;ray;save urei%s.png' " % (i, i, i, i, i, i, i) 
    os.system(pml_cmd) 
    #remove = "rm urei%s.pdb hollow_%s.pdb" % (i, i) 
    #os.system(remove) 
os.chdir("../") 

Bunu çalıştırmak ve bu hatayı alıyorum:


TypeError         Traceback (most recent call last) 
<ipython-input-8-53cd3e7bd107> in <module>() 
     7  os.system(comando) 
      8  pml_cmd = "pymol urei%s.pdb hollow_%s.pdb -c -d 'as cartoon, urei%s;color gray90, urei%s;center chain A;set_view (\-0.605158150,0.089404292,0.791067421,\0.795849979,0.093013920,0.598304033,\-0.020089993,0.991641700,-0.127439827,\0.000000000,0.000000000,-202.017959595,\-28.771762848,-7.683309555,10.745590210,\-568.485290527,972.520690918,-20.000000000);bg white;as sphere, hollow_%s;color cyan, hollow_%s;ray;save urei%s.png' " % (i, i, i, i, i, i, i) 
----> 9  os.system(pml_cmd) 
    10  #remove = "rm urei%s.pdb hollow_%s.pdb" % (i, i) 
    11  #os.system(remove) 

TypeError: must be string without null bytes, not str 

ben internette aradım ama iyi bir cevap bulamıyorum.

pml_cmd = r "pirol UREI% s:

cevap

3

sorun, dizge izleyen zamanlarda daha önce "\\" Veya alternatif olarak bir "R" eklemek için değiştirilebilir yani ya Çift çıkış gereken \ char olduğu yere dize boyunca bir NULL char olarak yorumlanır bir \ 0 olduğundan .Pdb ..."

Bu özel hata alıyorum

0

Ben print yorum oluşturma Bu hatayı gidermek başardı:

for tarfileobj in inputs: 
    # print(tarfileobj) 
    tarfileobj.extractall(path=t, members=None) 

print(tarfileobj.split) veya repr veya \0 null baytlarını çıkarmış olabilirsiniz, ya da bir tarfile varsa, onu ayıklayın.

İlgili konular