我在使用Python脚本创建独立程序包时遇到问题。我在MacOS中使用的是最新版本的python 3.8.3。当与程序相关的文档出现时,我的python脚本可以通过文件夹中的终端正常运行。
我尝试了Pyinstaller,py2app(在虚拟环境中),现在使用了鸭嘴兽。
在我重试其中之一之前,我只想检查所有文件/ python库是否安装在正确的位置。查看我的图书馆,我所有的文件都在
1. Footer.js
import React from "react";
import SimpleModal1 from "../components/UI/SimpleModal1"
class footer extends React.Component {
constructor (props) {
super(props);
this.state = {
isOpen: true,showModal: false,//requirements for sendgrid form
email: {
recipient: '',sender: '',subject: '',text: ''
}
}
}
//function to connect to sendgrid
sendEmail = _ => {
const { email } = this.state;
fetch(`http://127.0.0.1/:5000/send-email?recipient=${email.recipient}&sender=${email.sender}&topic=${email.subject}&text=${email.text}`) //query string url
.catch(err => console.error(err))
}
closeIt(event) {
this.setState({isOpen:'false'})
}
closeBox(event) {
this.setState({isOpen:false});
alert("We love you!!! Thanks a bunch!");
}
render() {
//sendgrid constants
const {email} = this.state;
const spacer ={
margin:10
}
const textArea = {
borderRadius:4
}
return (
<footer className="footer">
<div className="footer__copyright">
<p>
Contact Us At OurEmail@gmail.com
</p>
</div>
<button onClick={(e) => this.setState({isOpen:true})}> OpenDialog</button>
<SimpleModal1 isOpen={this.state.isOpen} onClose={(e) => this.setState({isOpen:false})}>
<top>See More Funny Videos....</top>
<input
autoFocus= {true}
fontSize="20px"
width= "50%"
value={email.text}
onChange={e => this.setState({email:{...email,text: e.target.value}})}
type="email"
id="email"
name="email"
placeholder="Email Please..."
required
/>
{/*
activate 2 functions with one button Josh*/}
<button onClick={() => {
this.sendEmail();
this.closeBox();
}}
> SUBSCRIBE!</button>
</SimpleModal1>
</div>
</footer>
);}
}
export default footer;
//
2.Backend/server/index.js:
const express = require('express');
const cors = require('cors');
const sgMail = require ('@sendgrid/mail');
const app = express();
sgMail.setApiKey('My API Key');
//remove restriction on email by calling cors
app.use(cors());
//Welcome Page
app.get('/',(req,res) => {
res.send('Welcome to Sendgrid Email Server')
});
app.get('/send-email',res)=> {
//Get Varaibles from query string
const {recipient,sender,topic,text } = req.query;
//SendGrid Requirements
const msg = {
to: 'SomeEmail@gmail.com',from: "AnotherEmail@gmail.com",subject: "A new email signup! ",text:text,}
//Send Email,console log the message
sgMail.send(msg)
.then((msg) => console.log(text))
})
//setting up email server port and console log message
app.listen(5000,()=> console.log("running on port 5000"));
//
3. Config.js :
module.exports = {
USER: 'mygmail@gmail.com',PASS: 'Password123!'
}
它们在正确的位置还是应该位于^顶层的Framework文件夹中?
尝试在py2app上打包应用程序的错误消息是:
Library > Frameworks > Python Framework > Versions > 3.8 > lib > python 3.8
Pyinstaller错误为:
2020-08-15 10:18:02.399 FIBA[27366:3763263] CGSTrackingRegionSetIsEnabled returned CG error 268435459
我的问题是:我的扩展名是否存储在正确的位置,Pyinstaller错误消息是否可以解决,谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。