sys

Run python script with some of the argument that are optional

半城伤御伤魂 提交于 2020-07-04 09:15:36
问题 I have gone through the sys documentation, however there is something that is still unclear to me. I have looked for some similar question on stackoverflow, but I haven't find anything useful (clearly any reference is appreciated!). I want to create a script - say foo.py - in which I want pass from 3 to 6 arguments: $ python foo.py arg1 arg2 arg3 The first 3 arguments must be given in any case; the last 3 arguments are used in a function that have default argument values if nothing is passed.

Oracle Sys和system用户区别

半腔热情 提交于 2020-04-11 17:49:03
区别之一: 存储的数据的重要性不同 sys 用户 所有oracle的数据字典的基表和视图都存放在sys用户中,这些基表和视图对于oracle的运行是至关重要的,由数据库自己维护,任何用户都不能手动更改。sys用户拥有dba,sysdba,sysoper等角色或权限,是oracle权限最高的用户。 systeM 用户用于存放次一级的内部数据,如oracle的一些特性或工具的管理信息。system用户拥有普通dba角色权限。 区别之二:权限的不同。 sys 用户具有“SYSDBA”或者“SYSOPER”系统权限,登陆em也只能用这两个身份,不能用normal。 system 用户只能用normal身份登陆em,除非你对它授予了sysdba的系统权限或者syspoer系统权限。 示例:  以sys用户登陆Oracle,执行select * from V_$PWFILE_USERS;可查询到具有sysdba权限的用户,如: SQL> select * from v$pwfile_users; USERNAME SYSDBA SYSOPER ------------------------------ ------ ------- SYS TRUE TRUE SYSTEM TRUE FALSE 来源: oschina 链接: https://my.oschina.net/u/2971691

Jupyter notebook, wrong sys.path and sys.executable

落爺英雄遲暮 提交于 2020-03-17 06:02:04
问题 I'm trying to run the anaconda distribution of python libraries in a Jupyter Notebook, but when I run the notebook I keep getting ImportErrors because the python path is set to the default distribution from Mac OS X 10.11 When I print out the sys.path and sys.executable, they differ when running python vs running jupyter notebook. For example, from pprint import pprint as p import sys p(sys.path) After doing this in python I get the correct output: ['', '/Users/glennraskovich/anaconda2/lib

IPython sys.path different from python sys.path

独自空忆成欢 提交于 2020-01-10 03:56:08
问题 I generally use IPython and only recently noticed that the the search path for imports is wrong in the regular python shell. From what I understand, sys.path inherits from PYTHONPATH (although I don't know where PYTHONPATH lives), is this different in IPython? I'm worried that this effecting installations. For instance I just tried pip install --upgrade gensim which failed because it couldn't resolve the scipy dependency, which I already have installed. So I dove a little bit deeper and found

How to import files in python using sys.path.append?

你。 提交于 2020-01-09 19:16:14
问题 There are two directories on my desktop, DIR1 and DIR2 which contain the following files: DIR1: file1.py DIR2: file2.py myfile.txt The files contain the following: file1.py import sys sys.path.append('.') sys.path.append('../DIR2') import file2 file2.py import sys sys.path.append( '.' ) sys.path.append( '../DIR2' ) MY_FILE = "myfile.txt" myfile = open(MY_FILE) myfile.txt some text Now, there are two scenarios. The first works, the second gives an error. Scenario 1 I cd into DIR2 and run file2

How to import files in python using sys.path.append?

柔情痞子 提交于 2020-01-09 19:15:31
问题 There are two directories on my desktop, DIR1 and DIR2 which contain the following files: DIR1: file1.py DIR2: file2.py myfile.txt The files contain the following: file1.py import sys sys.path.append('.') sys.path.append('../DIR2') import file2 file2.py import sys sys.path.append( '.' ) sys.path.append( '../DIR2' ) MY_FILE = "myfile.txt" myfile = open(MY_FILE) myfile.txt some text Now, there are two scenarios. The first works, the second gives an error. Scenario 1 I cd into DIR2 and run file2

How to import files in python using sys.path.append?

断了今生、忘了曾经 提交于 2020-01-09 19:14:04
问题 There are two directories on my desktop, DIR1 and DIR2 which contain the following files: DIR1: file1.py DIR2: file2.py myfile.txt The files contain the following: file1.py import sys sys.path.append('.') sys.path.append('../DIR2') import file2 file2.py import sys sys.path.append( '.' ) sys.path.append( '../DIR2' ) MY_FILE = "myfile.txt" myfile = open(MY_FILE) myfile.txt some text Now, there are two scenarios. The first works, the second gives an error. Scenario 1 I cd into DIR2 and run file2

Colored Python Prompt in Windows?

☆樱花仙子☆ 提交于 2020-01-06 08:37:28
问题 Here's my script that currently sets up my prompts for all of my computers (whether they're Windows, Red Hat, or OS X): import sys import datetime import platform if platform.system() is 'Windows': tealUText = "" tealText = "" greenText = "" defaultText = "" else: tealUText = "\001\033[4;36m\002" tealText = "\001\033[0;36m\002" greenText = "\001\033[0;32m\002" defaultText = "\001\033[0;0m\002" class ClockPS1(object): def __repr__(self): now = datetime.datetime.now() clock = str(now.strftime("

Why does writing to stdout in console append the number of characters written, in Python 3?

点点圈 提交于 2020-01-03 09:30:10
问题 I was just playing around with sys.stdout.write() in a Python console when I noticed that this gives some strange output. For every write() call the number of characters written, passed to the function respectively gets append to the output in console. >>> sys.stdout.write('foo bar') for example results in foo bar7 being printed out. Even passing an empty string results in an output of 0 . This really only happens in a Python console, but not when executing a file with the same statements.

python: sys is not defined

旧街凉风 提交于 2019-12-30 05:32:07
问题 I have a piece of code which is working in Linux, and I am now trying to run it in windows, I import sys but when I use sys.exit(). I get an error, sys is not defined. Here is the begining part of my code try: import numpy as np import pyfits as pf import scipy.ndimage as nd import pylab as pl import os import heapq import sys from scipy.optimize import leastsq except ImportError: print "Error: missing one of the libraries (numpy, pyfits, scipy, matplotlib)" sys.exit() Why is sys not working?