我尝试使用CreateProcess() argument 2 must be string without null bytes or None, not str
在我的应用中发送电子邮件。
Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\exception.py" in inner
41. response = get_response(request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python27\lib\site-packages\django\views\decorators\csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\views\generic\base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\rest_framework\views.py" in dispatch
489. response = self.handle_exception(exc)
File "C:\Python27\lib\site-packages\rest_framework\views.py" in handle_exception
449. self.raise_uncaught_exception(exc)
File "C:\Python27\lib\site-packages\rest_framework\views.py" in dispatch
486. response = handler(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\rest_framework\generics.py" in get
201. return self.list(request, *args, **kwargs)
File "C:\Python27\lib\site-packages\rest_framework\mixins.py" in list
45. return self.get_paginated_response(serializer.data)
File "C:\Python27\lib\site-packages\rest_framework\serializers.py" in data
739. ret = super(ListSerializer, self).data
File "C:\Python27\lib\site-packages\rest_framework\serializers.py" in data
263. self._data = self.to_representation(self.instance)
File "C:\Python27\lib\site-packages\rest_framework\serializers.py" in to_representation
657. self.child.to_representation(item) for item in iterable
File "C:\Python27\lib\site-packages\rest_framework\serializers.py" in to_representation
501. ret[field.field_name] = field.to_representation(attribute)
File "C:\Python27\lib\site-packages\rest_framework\fields.py" in to_representation
1755. return method(value)
File "C:\Users\User\Desktop\Feed\backend\api\media\video.py" in get_duration
61. result = getLength(obj.video_file)
File "C:\Users\User\Desktop\Feed\backend\api\media\video.py" in getLength
33. result = subprocess.Popen(['ffprobe', filename], stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
File "C:\Python27\lib\subprocess.py" in __init__
390. errread, errwrite)
File "C:\Python27\lib\subprocess.py" in _execute_child
640. startupinfo)
Exception Type: TypeError at /api/v1/media/video/feed/
Exception Value: CreateProcess() argument 2 must be string without null bytes or None, not str
运行我的应用程序后,显示了作曲器屏幕,但是没有显示MFMailComposeViewController
和let email = "..."
let mailComposer = MFMailComposeViewController()
mailComposer.mailComposeDelegate = self
mailComposer.setToRecipients([email])
self.navigationController?.present(mailComposer, animated: true)
按钮。我尝试了许多可能的解决方案,因为两个NavigationControllers都更改了cancel
。例如:
send
但是“问题”仍然存在。
有什么想法吗?
答案 0 :(得分:1)
请尝试以下代码
class TechSupportVC: UIViewController, MFMailComposeViewControllerDelegate {
let composeVC = MFMailComposeViewController()
override func viewDidLoad() {
super.viewDidLoad()
composeVC.mailComposeDelegate = self
composeVC.setToRecipients(["desiredEmail@gmail.com"])
composeVC.setSubject("My message")
}
func mailComposeController(_ controller: MFMailComposeViewController,
didFinishWith result: MFMailComposeResult,
error: Swift.Error?) {
controller.dismiss(animated: true, completion: nil)
}
@IBAction func sendPressed(_ sender: Any) {
guard MFMailComposeViewController.canSendMail() else {
showMailServiceErrorAlert()
return
}
composeVC.setMessageBody("Test credentials: \(firstAndLastNameTextField.text!)\nPhone: \(numberTextField.text!)\n\n\(messageTextView.text!)", isHTML: false)
self.present(composeVC, animated: true, completion: nil)
}
答案 1 :(得分:0)
mailComposeDelegate
应该继承自UIViewController
。
在其他情况下,解雇MFMailComposeViewController
无效并崩溃。
好像是苹果的虫子