import { useUpdateThing } from 'path/to/updateThing'
function MyComponent () {
const { updateThing} = useUpdateThing();
return (
<View>
<NestedComponent onUpdate={updateThing} />
</View>
)
}
所以在pycharm中一切正常,但是当我从.py中创建.exe时,它在CMD中显示“找不到模块”错误
您知道我在这里做错了吗? 感谢您的帮助!
答案 0 :(得分:0)
由于您使用的是pycharm,请确保在项目设置中使用了正确的python解释器。如果您使用的是系统解释器,则在虚拟环境中找不到模块
我稍微整理了一下代码:
import os
from pathlib import Path
import linecache
import pyperclip
# Specify the path
dir = Path('C:/Users/Akush/Documents/Warcraft III/CustomMapData/YouTD/')
# Specify the file
file = 'savecode.txt'
# Start Searching for Path
print('Looking for a path...')
# Check if Path exists
if dir.is_dir():
# Set the currect working directory to the found path
os.chdir(dir)
# Let the user know the path has been found
print('Found path!')
# Check to see if the file exists
if Path(file).is_file():
# Get lines from file
a = linecache.getline(file, 7)
if a == '':
print('Nothing found in file')
else:
# Copy line to clipboard
pyperclip.copy(a)
print(f'{a} copied to clipboard!')
else:
print("File not found")
else:
print('This directory does not exist')