日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python打开另一个程序_python 新手问题啊,为什么我运行一个python程序,另一个就会自动退出呢?始终只能运行一个...

發布時間:2024/9/27 python 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python打开另一个程序_python 新手问题啊,为什么我运行一个python程序,另一个就会自动退出呢?始终只能运行一个... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

/data/python/caiji_asc.py

/data/python/caiji_desc.py

兩個文件的代碼幾乎一樣的,就是查詢mysql的時候order 排序不一樣

下面是具體代碼,剛學幾天,網上東拼西湊出來的,高手幫忙看看吧

我用ssh連接服務器 運行這兩個python 程序始終都是一個運行了另一個自動exit。。實在不明白怎么回事??

#!/usr/bin/python

#-*-coding:utf-8-*-

import MySQLdb, os, socket, time;

import MySQLdb.cursors;

import urllib

User = 'root';

Passwd = '123456';

Host = 'localhost';

Db = 'test_xs';

conn = MySQLdb.connect(user=User,passwd=Passwd,host=Host,db=Db);

mysql = conn.cursor(cursorclass = MySQLdb.cursors.DictCursor);

mysql.execute("select * from image order by id asc");

result = mysql.fetchall();

startTime = time.time();

timeout = 10; # in seconds

socket.setdefaulttimeout(timeout);

for row in result:

dir = os.path.dirname(row['path']);

if not os.path.exists(dir):

os.makedirs(dir);

os.chmod(dir, 0777);

os.chmod(os.path.dirname(dir), 0777);

data = urllib.urlretrieve(row['url'], row['path']);

os.chmod(row['path'], 0777);

mysql.execute("delete from image where id = %s", row['id']);

passTime = int(time.time()) - int(startTime);

if passTime >= 3600:

break;

print str(row['id']);

mysql.close();

conn.close();

[root@localhost ~]# nohup /data/python/caiji_asc.py > /dev/null 2>&1 &

[1] 4272

[root@localhost ~]# nohup /data/python/caiji_desc.py > /dev/null 2>&1 &

[2] 4273

[1] Exit 126 nohup /data/python/caiji_asc.py > /dev/null 2>&1

[root@localhost ~]# nohup /data/python/caiji_asc.py > /dev/null 2>&1 &

[3] 4274

[2] Exit 126 nohup /data/python/caiji_desc.py > /dev/null 2>&1

[root@localhost ~]# nohup python /data/python/caiji_asc.py > /dev/null 2>&1 &

[4] 4275

[3] Exit 126 nohup /data/python/caiji_asc.py > /dev/null 2>&1

[root@localhost ~]# nohup /data/python/caiji_asc.py > /dev/null 2>&1 &

[5] 4277

[root@localhost ~]# nohup /data/python/caiji_desc.py > /dev/null 2>&1 &

[6] 4278

[5] Exit 126 nohup /data/python/caiji_asc.py > /dev/null 2>&1

[root@localhost ~]# /data/python/caiji_desc.py > /dev/null 2>&1 &

[7] 4283

[4] Done nohup python /data/python/caiji_asc.py > /dev/null 2>&1

[6] Exit 126 nohup /data/python/caiji_desc.py > /dev/null 2>&1

[root@localhost ~]# /data/python/caiji_asc.py > /dev/null 2>&1 &

[8] 4284

[7] Exit 126 /data/python/caiji_desc.py > /dev/null 2>&1

貌似數據庫里面數據已經都被刪除了的問題吧 。。 現在測試又正常了。 暈死。。

總結

以上是生活随笔為你收集整理的python打开另一个程序_python 新手问题啊,为什么我运行一个python程序,另一个就会自动退出呢?始终只能运行一个...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。