Re: Beginner problem, please help. Building a simple menu + lists , cannot print list

2021-10-11 Thread Chris Angelico
On Tue, Oct 12, 2021 at 9:13 AM Felix Kjellström
 wrote:
>
> Hello! Please see the link to the code I have uploaded to my account at 
> replit.com
>
> https://replit.com/join/lftxpszwrv-felixkjellstrom

Unfortunately, it's not public. Are you able to put the code on GitHub
as a repository or gist, or in some other public hosting?
Alternatively, can you make it short enough to simply include here in
your post?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Beginner problem, please help. Building a simple menu + lists , cannot print list

2021-10-11 Thread Felix Kjellström
Hello! Please see the link to the code I have uploaded to my account at 
replit.com

https://replit.com/join/lftxpszwrv-felixkjellstrom

Problem:

When you select the menu option "Add buyer", you can enter three values. See 
code line 5, "def Add_buyer ():"

Then, you use the arrow keys to select the menu option "See list of buyers". 
When you do that the values you just entered should be printed. See code line 
23, "def See_list_of_buyers ():

The problem is that the list is DON'T gets printed.

Problem:

When you select the menu option "Add buyer", you can enter three values. See 
code line 5, "def Add_buyer ():"

Then, you use the arrow keys to select the menu option "See list of buyers". 
When you do that the values you just entered should be printed. See code line 
23, "def See_list_of_buyers ():

The problem is that the list is DON'T gets printed.

-- 
https://mail.python.org/mailman/listinfo/python-list


connection aborted error please help to fix it

2021-08-17 Thread hi





   Sent from [1]Mail for Windows



References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: please help

2021-08-16 Thread Dennis Lee Bieber
On Mon, 16 Aug 2021 20:24:17 +0100, MRAB 
declaimed the following:

>On 2021-08-16 02:19, vitalis wrote:
>> I keep getting this error while trying to install pyqt5 designer
>> 
>> Fatal error in launcher: Unable to create process using '"c:\program
>> files\python39\python.exe"  "C:\Program Files\Python39\Scripts\pip.exe"
>> install PyQt5Designer': The system cannot find the file specified.
>> 
>> please what do I do about this
>> 
>Try using the Python Launcher and the pip module:
>
> py -3.9 -m install PyQt5Designer

py-3.9 -m pip install PyQt5Designer...

However I would want to see the exact command line (not whatever
reformatting took place in the error message). Literal reading of that
message implies the OP is trying to pass a pip EXECUTABLE as the program to
be run by Python, rather than a pip .py file.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: please help

2021-08-16 Thread MRAB

On 2021-08-16 02:19, vitalis wrote:

I keep getting this error while trying to install pyqt5 designer

Fatal error in launcher: Unable to create process using '"c:\program
files\python39\python.exe"  "C:\Program Files\Python39\Scripts\pip.exe"
install PyQt5Designer': The system cannot find the file specified.

please what do I do about this


Try using the Python Launcher and the pip module:

py -3.9 -m install PyQt5Designer
--
https://mail.python.org/mailman/listinfo/python-list


please help

2021-08-16 Thread vitalis
   I keep getting this error while trying to install pyqt5 designer

   Fatal error in launcher: Unable to create process using '"c:\program
   files\python39\python.exe"  "C:\Program Files\Python39\Scripts\pip.exe"
   install PyQt5Designer': The system cannot find the file specified.

   please what do I do about this





   Sent from [1]Mail for Windows



References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


GridSearchCV generates unexpected different best parameters by only changing the parameters order in param_grid. Please help!

2021-02-25 Thread Yi Li
I am using GridSearchCV to find the best parameter setting of my 
sklearn.pipeline estimator. The pipeline consists of data transformation, UMAP 
dimension reduction and Kmeans clustering.
The final Kmeans clustering results are scored using silhouette_score. I tried 
to verify the whole pipeline/GridSearchCV worked correctly by only changing the 
parameter order in param_grid (
e.g., change 'reduce__n_neighbors': (5, 10), to 'reduce__n_neighbors': (10, 
5)). I got totally different best parameters although I expect the parameter 
order change should not impact the 
best paramters determined by GridSearchCV. Where did I make mistake and how to 
fix this unexpected results?

Below is the code. The Debug class is used to save the output from 'reduce' 
step. This saved output is used in cv_silhouette_scorer() to calculate 
silhouette_score. I suspect Debug class and cv_silhouette_scorer() 
did not work as I expected. 

I really appreciate your help.

class Debug(BaseEstimator, TransformerMixin):
def __init__(self):
self.transX = None

def transform(self, X):
print(X)
self.transX = X.copy()
return X

def fit(self, X, y=None, **fit_params):
return self

def cv_silhouette_scorer(estimator, X):
# estimator.fit(X)
sdata = estimator.named_steps['debug'].transX
cluster_labels = estimator.named_steps['cluster'].labels_
num_labels = len(set(cluster_labels))
num_samples = sdata.shape[0]
if num_labels == 1 or num_labels == num_samples:
return -1
else:
return silhouette_score(sdata, cluster_labels)


ohe = OneHotEncoder(drop='if_binary', dtype=np.float32)
ore = OrdinalEncoder(dtype=np.float32)
ctenc = ColumnTransformer(transformers=[('ohe', ohe, nom_vars), ('ore', ore, 
ord_vars)], 
  remainder='passthrough')
nftr = FunctionTransformer(nominal_indicator_missing, check_inverse=False, 
  kw_args={'feat_names': ohecols, 'orig_cols': 
nom_vars})
oftr = FunctionTransformer(ordinal_indicator_missing, check_inverse=False,
kw_args={'miss_value': 0.})

ctmiss = ColumnTransformer(transformers=[('nftr', nftr, slice(0, 19)), ('oftr', 
oftr, slice(19, 20)), ('drop_cols', 'drop' , slice(32, 36) )], 
remainder='passthrough')

mputer = IterativeImputer(random_state=RS, add_indicator=True, 
initial_strategy="most_frequent", skip_complete=True)


# Add below keep_vars transformer to drop all demographic columns before pass 
to UMAP

keep_cols = ColumnTransformer(transformers=[('keep_cols1', 'passthrough' , 
slice(17, 25) ), ('keep_cols2', 'passthrough' , slice(46, 54) )] )

scaler = StandardScaler()

trans = FunctionTransformer(np.transpose, check_inverse=False)

dreduce = umap.UMAP(random_state=RS)
knn = KMeans(random_state=RS)
pipe = Pipeline(steps=[
('enc', ctenc)
, ('functr', ctmiss)
, ('mpute', mputer)
, ('keep_cols', keep_cols)
, ('scale', scaler)
, ('trans', trans)
, ('reduce', dreduce)
, ("debug", Debug())
, ('cluster', knn)
]
)

parameters = {
'mpute__max_iter': (15, 20),
'reduce__n_neighbors': (5, 10),
'reduce__min_dist': (0.02, 0.05),
'reduce__n_components': (2, 3),
'reduce__metric': ('euclidean', 'manhattan'),
'cluster__n_clusters': (2, 3),
'cluster__n_init': (10, 25)
}
# Changing parameter order above as below, GridSearchCV reports different best 
parameters.

# parameters = {
# 'mpute__max_iter': (20, 15),
# 'reduce__n_neighbors': (10, 5),
# 'reduce__min_dist': (0.05, 0.02),
# 'reduce__n_components': (3, 2),
# 'reduce__metric': ('manhattan', 'eucidean'),
# 'cluster__n_clusters': (3, 2),
# 'cluster__n_init': (25, 10)
# }


gsearch3 = GridSearchCV(pipe, parameters, n_jobs=-1, 
scoring=cv_silhouette_scorer , cv=5, verbose=1)
gsearch3.fit(dfnew)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help test astral char display in tkinter Text (especially *nix)

2020-11-06 Thread Anssi Saari
Terry Reedy  writes:

> Perhaps half of the assigned chars in the first plane are printed
> instead of being replaced with a narrow box. This includes emoticons
> as foreground color outlines on background color.  Maybe all of the
> second plane of extended CJK chars are printed.  The third plane is
> unassigned and prints as unassigned boxes (with an X).

I get the same as Menno Holscher (i.e. messages with "character is above
the range blah blah") in Debian 10 with the system provided Python
3.7.3. Tcl and tk are 8.6.9.

With Python 3.9.0 I get something like what you described above. Some
chars print, lots of empty boxes too and lots of just empty space. No
boxes with an X and no errors.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help test astral char display in tkinter Text (especially *nix)

2020-11-05 Thread Terry Reedy

On 11/4/2020 7:47 AM, Menno Holscher wrote:

Op 03-11-2020 om 04:04 schreef Terry Reedy:
Perhaps half of the assigned chars in the first plane are printed 
instead of being replaced with a narrow box. This includes emoticons 
as foreground color outlines on background color.  Maybe all of the 
second plane of extended CJK chars are printed.  The third plane is 
unassigned and prints as unassigned boxes (with an X).


If you get errors, how many.  If you get a hang or crash, how far did 
the program get?



openSuse Linux 15.2 Leap, Python 3.6.10, tcl and tk 8.6.7

The program runs fine, but complains in the text scrollbox:
0x1 character U+1 is above the range (U+-U+) allowed by Tcl

until

0x3ffe0 character U+3ffe0 is above the range (U+-U+) allowed by Tcl


Thank you.  I assume that this message replaces the line of 32, which 
tcl did not attempt to print.  Much better than crashing.


I should have specified that not printing is likely for any python older 
than about year.  I have no idea what would happen with current Python 
and tcl/tk older than the 8.6.8 provided with the Windows installer.


--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


Re: Please help test astral char display in tkinter Text (especially *nix)

2020-11-04 Thread Menno Holscher

Op 03-11-2020 om 04:04 schreef Terry Reedy:
Perhaps half of the assigned chars in the first plane are printed 
instead of being replaced with a narrow box. This includes emoticons as 
foreground color outlines on background color.  Maybe all of the second 
plane of extended CJK chars are printed.  The third plane is unassigned 
and prints as unassigned boxes (with an X).


If you get errors, how many.  If you get a hang or crash, how far did 
the program get?



openSuse Linux 15.2 Leap, Python 3.6.10, tcl and tk 8.6.7

The program runs fine, but complains in the text scrollbox:
0x1 character U+1 is above the range (U+-U+) allowed by Tcl

until

0x3ffe0 character U+3ffe0 is above the range (U+-U+) allowed by Tcl

Menno Hölscher


--
https://mail.python.org/mailman/listinfo/python-list


Please help test astral char display in tkinter Text (especially *nix)

2020-11-03 Thread Terry Reedy
tcl/tk supports unicode chars in the BMP (Basic Multilingual Plane, 
utf-8 encoded with 1-3 bytes).  The presence of chars in other plains 
('astral', utf-8 encoded with 4 bytes, I believe) in a tkinter Text 
widget messages up *editing*, but they can sometimes be displayed with 
appropriate glyphs.


On my Windows 10 64-bit 2004 update, astral code points print as 
unassigned [X], replaced [], or proper glyphs (see below).  On my 
up-to-date macOS Mohave, as far as I know, no glyphs are actually 
printed and some hang, freezing IDLE's Shell (and making extensive 
testing difficult).  On Linux, behavior is mixed, including 'crashes', 
with the use of multicolor rather than black/white fonts apparently an 
issue.  https://bugs.python.org/issue42225.  I would like more 
information about behavior on other systems, especially *nix.


The following runs to completion for me, without errors, in about 1 second.

tk = True
if tk:
from tkinter import Tk
from tkinter.scrolledtext import ScrolledText
root = Tk()
text = ScrolledText(root, width=80, height=40)
text.pack()
def print(txt):
text.insert('insert', txt+'\n')

errors = []
for i in range(0x1, 0x4, 32):
chars = ''.join(chr(i+j) for j in range(32))
try:
   print(f"{hex(i)} {chars}")
except Exception as e:
errors.append(f"{hex(i)} {e}")
print("ERRORS:")
for line in errors:
print(line)

Perhaps half of the assigned chars in the first plane are printed 
instead of being replaced with a narrow box. This includes emoticons as 
foreground color outlines on background color.  Maybe all of the second 
plane of extended CJK chars are printed.  The third plane is unassigned 
and prints as unassigned boxes (with an X).


If you get errors, how many.  If you get a hang or crash, how far did 
the program get?


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


How to convert csv to netcdf please help me python users

2020-05-29 Thread kotichowdary28
Hi all

I hope all are  doing well

please help me how to convert CSV to NetCDF. Im trying but its not working


#!/usr/bin/env ipython
import pandas as pd
import numpy as np
import netCDF4
import pandas as pd
import xarray as xr


stn_precip='ts_sept.csv'
orig_precip='ts_sept.csv'
stations = pd.read_csv(stn_precip)

stncoords = stations.iloc[:]
orig = pd.read_csv(orig_precip)
lats = stncoords['latitude']
lons = stncoords['longitude']
nstations = np.size(lons)
ncout = netCDF4.Dataset('Precip_1910-2018_homomod.nc', 'w')

ncout.createDimension('station',nstations)
ncout.createDimension('time',orig.shape[0])

lons_out = lons.tolist()
lats_out = lats.tolist()
time_out = orig.index.tolist()

lats = ncout.createVariable('latitude',np.dtype('float32').char,('station',))
lons = ncout.createVariable('longitude',np.dtype('float32').char,('station',))
time = ncout.createVariable('time',np.dtype('float32').char,('time',))
precip = ncout.createVariable('precip',np.dtype('float32').char,('time', 
'station'))

lats[:] = lats_out
lons[:] = lons_out
time[:] = time_out
precip[:] = orig
ncout.close()

 

-- 
https://mail.python.org/mailman/listinfo/python-list


please help me while installing pyttsx3 it shows error

2020-04-27 Thread AMAN BHAI PATEL
PS C:\Users\amanb\OneDrive\Desktop\jarvis> pip install pyttsx3
Collecting pyttsx3
  Using cached pyttsx3-2.87-py3-none-any.whl (39 kB)
Collecting comtypes; platform_system == "Windows"
  Using cached comtypes-1.1.7.zip (180 kB)
Installing collected packages: comtypes, pyttsx3
Running setup.py install for comtypes ... error
ERROR: Command errored out with exit status 1:
 command: 
'C:\Users\amanb\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe'
 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = 
'"'"'C:\\Users\\amanb\\AppData\\Local\\Temp\\pip-install-uwazge93\\comtypes\\setup.py'"'"';
 
__file__='"'"'C:\\Users\\amanb\\AppData\\Local\\Temp\\pip-install-uwazge93\\comtypes\\setup.py'"'"';f=getattr(tokenize,
 '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install 
--record 
'C:\Users\amanb\AppData\Local\Temp\pip-record-3lktlb2m\install-record.txt' 
--single-version-externally-managed 
--user --prefix= --compile --install-headers 
'C:\Users\amanb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Include\comtypes'
 cwd: C:\Users\amanb\AppData\Local\Temp\pip-install-uwazge93\comtypes\
Complete output (276 lines):
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\comtypes
copying comtypes\automation.py -> build\lib\comtypes
copying comtypes\connectionpoints.py -> build\lib\comtypes
copying comtypes\errorinfo.py -> build\lib\comtypes
copying comtypes\git.py -> build\lib\comtypes
copying comtypes\GUID.py -> build\lib\comtypes
copying comtypes\hresult.py -> build\lib\comtypes
copying comtypes\logutil.py -> build\lib\comtypes
copying comtypes\messageloop.py -> build\lib\comtypes
copying comtypes\npsupport.py -> build\lib\comtypes
copying comtypes\patcher.py -> build\lib\comtypes
copying comtypes\persist.py -> build\lib\comtypes
copying comtypes\safearray.py -> build\lib\comtypes
copying comtypes\shelllink.py -> build\lib\comtypes
copying comtypes\typeinfo.py -> build\lib\comtypes
copying comtypes\util.py -> build\lib\comtypes
copying comtypes\viewobject.py -> build\lib\comtypes
copying comtypes\_comobject.py -> build\lib\comtypes
copying comtypes\_meta.py -> build\lib\comtypes
copying comtypes\_safearray.py -> build\lib\comtypes
copying comtypes\__init__.py -> build\lib\comtypes
creating build\lib\comtypes\client
copying comtypes\client\dynamic.py -> build\lib\comtypes\client
copying comtypes\client\lazybind.py -> build\lib\comtypes\client
copying comtypes\client\_code_cache.py -> build\lib\comtypes\client
copying comtypes\client\_events.py -> build\lib\comtypes\client
copying comtypes\client\_generate.py -> build\lib\comtypes\client
copying comtypes\client\__init__.py -> build\lib\comtypes\client
creating build\lib\comtypes\server
copying comtypes\server\automation.py -> build\lib\comtypes\server
copying comtypes\server\connectionpoints.py -> build\lib\comtypes\server
copying comtypes\server\inprocserver.py -> build\lib\comtypes\server
copying comtypes\server\localserver.py -> build\lib\comtypes\server
copying comtypes\server\register.py -> build\lib\comtypes\server
copying comtypes\server\w_getopt.py -> build\lib\comtypes\server
copying comtypes\server\__init__.py -> build\lib\comtypes\server
creating build\lib\comtypes\tools
copying comtypes\tools\codegenerator.py -> build\lib\comtypes\tools
copying comtypes\tools\tlbparser.py -> build\lib\comtypes\tools
copying comtypes\tools\typedesc.py -> build\lib\comtypes\tools
copying comtypes\tools\typedesc_base.py -> build\lib\comtypes\tools
copying comtypes\tools\__init__.py -> build\lib\comtypes\tools
creating build\lib\comtypes\test
copying comtypes\test\find_memleak.py -> build\lib\comtypes\test
copying comtypes\test\runtests.py -> build\lib\comtypes\test
copying comtypes\test\setup.py -> build\lib\comtypes\test
copying comtypes\test\TestComServer.py -> build\lib\comtypes\test
copying comtypes\test\TestDispServer.py -> build\lib\comtypes\test
copying comtypes\test\test_agilent.py -> build\lib\comtypes\test
copying comtypes\test\test_avmc.py -> build\lib\comtypes\test
copying comtypes\test\test_basic.py -> build\lib\comtypes\test
copying comtypes\test\test_BSTR.py -> build\lib\comtypes\test
copying comtypes\test\test_casesensitivity.py -> build\lib\comtypes\test
copying comtypes\test\test_client.py -> build\lib\comtypes\test
copying comtypes\test\test_collections.py -> build\lib\comtypes\test
copying comtypes\test\test_comserver.py -> build\lib\comtypes\test
copying comtypes\test\test_createwrappers.py -> build\lib\comtypes\test
copying 

Re: Please Help! Absolute Novice - New Job, have this task.

2020-03-18 Thread bob gailer
Request for future: give us a specific subject e.g. how do I restore a 
button's text/color ?


On 3/18/2020 6:05 PM, mjnash...@gmail.com wrote:

Absolute beginner here, have no idea what I am doing wrong. All I want to do here is have 
the pushButton in PyQt5 to change to "Working..." and Red when clicked... which 
it currently does.

That's amazing since your code sets the text to WORKING...

Thing is I need it to also change back to the default "SCAN" and Green color 
when done running that method the button is linked to...

I know this is a super simple problem, and forgive any Novice errors in this 
code. I know very very little but if you guys can help me I would highly 
appreciate it!!! :)

from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import pyautogui



class Ui_MainWindow(object):
 def setupUi(self, MainWindow):
 MainWindow.setObjectName("MainWindow")
 MainWindow.showMaximized()
 MainWindow.setMinimumSize(QtCore.QSize(0, 0))
 MainWindow.setMaximumSize(QtCore.QSize(3840, 2160))
 font = QtGui.QFont()
 font.setFamily("Arial Black")
 MainWindow.setFont(font)
 MainWindow.setStyleSheet("background-color: rgba(0, 85, 127, 100);")
 self.centralwidget = QtWidgets.QWidget(MainWindow)
 self.centralwidget.setObjectName("centralwidget")
 self.pushButton = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton.setGeometry(QtCore.QRect(250, 250, 400, 150))
 font = QtGui.QFont()
 font.setFamily("Tahoma")
 font.setPointSize(24)
 font.setBold(True)
 font.setWeight(75)
 self.pushButton.setFont(font)
 self.pushButton.setStyleSheet("background-color: rgb(0, 170, 0);\n"
"color: rgb(255, 255, 255);")
 self.pushButton.setObjectName("pushButton")
 self.label = QtWidgets.QLabel(self.centralwidget)
 self.label.setGeometry(QtCore.QRect(730, 300, 701, 111))
 font = QtGui.QFont()
 font.setPointSize(18)
 font.setBold(True)
 font.setItalic(False)
 font.setWeight(75)
 self.label.setFont(font)
 self.label.setLayoutDirection(QtCore.Qt.LeftToRight)
 self.label.setObjectName("label")
 MainWindow.setCentralWidget(self.centralwidget)
 self.menubar = QtWidgets.QMenuBar(MainWindow)
 self.menubar.setGeometry(QtCore.QRect(0, 0, 1920, 18))
 self.menubar.setObjectName("menubar")
 MainWindow.setMenuBar(self.menubar)
 self.statusbar = QtWidgets.QStatusBar(MainWindow)
 self.statusbar.setObjectName("statusbar")
 MainWindow.setStatusBar(self.statusbar)

 self.retranslateUi(MainWindow)
 QtCore.QMetaObject.connectSlotsByName(MainWindow)

 def retranslateUi(self, MainWindow):
 _translate = QtCore.QCoreApplication.translate
 MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
 self.label.setStyleSheet("background-color: rgba(0, 85, 127, 0);\n"
"color: rgb(255, 255, 255);")
 self.pushButton.setText(_translate("MainWindow", "SCAN"))
 self.label.setText(_translate("MainWindow", "WELCOME"))

 self.pushButton.clicked.connect(self.copy)

When user clicks button self.copy is invoked. True?

 def copy(self, MainWindow):
 self.pushButton.setText('WORKING...')

Why do you sometimes use _translate and not other times?

 self.pushButton.setStyleSheet("background-color: rgb(250, 0, 0);\n"
"color: rgb(255, 255, 255);")
 testprompt=storeid=pyautogui.prompt(text='test', title='test')


This method does no actual work! If you add

self.pushButton.setText(_translate("MainWindow", "SCAN"))
self.pushButton.setStyleSheet # whatever it was originally

it will reset the button. Of course it will so really fast, as there is 
no actual work being done.


So you should first address the issue of actually doing something that 
will take a little time. Also it is not a good idea to duplicate code, 
so I would put those 2 lines in a function and call that function from 2 
places.


Am I going in the right direction? Am I missing something?


class Application():
 def run():
 import sys
 app = QtWidgets.QApplication(sys.argv)
 MainWindow = QtWidgets.QMainWindow()
 ui = Ui_MainWindow()
 ui.setupUi(MainWindow)
 MainWindow.show()
 sys.exit(app.exec_())

Application.run()

Bob Gailer
--
https://mail.python.org/mailman/listinfo/python-list


Please Help! Absolute Novice - New Job, have this task.

2020-03-18 Thread mjnash194
Absolute beginner here, have no idea what I am doing wrong. All I want to do 
here is have the pushButton in PyQt5 to change to "Working..." and Red when 
clicked... which it currently does. Thing is I need it to also change back to 
the default "SCAN" and Green color when done running that method the button is 
linked to...

I know this is a super simple problem, and forgive any Novice errors in this 
code. I know very very little but if you guys can help me I would highly 
appreciate it!!! :)

from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import pyautogui



class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.showMaximized()
MainWindow.setMinimumSize(QtCore.QSize(0, 0))
MainWindow.setMaximumSize(QtCore.QSize(3840, 2160))
font = QtGui.QFont()
font.setFamily("Arial Black")
MainWindow.setFont(font)
MainWindow.setStyleSheet("background-color: rgba(0, 85, 127, 100);")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(250, 250, 400, 150))
font = QtGui.QFont()
font.setFamily("Tahoma")
font.setPointSize(24)
font.setBold(True)
font.setWeight(75)
self.pushButton.setFont(font)
self.pushButton.setStyleSheet("background-color: rgb(0, 170, 0);\n"
"color: rgb(255, 255, 255);")
self.pushButton.setObjectName("pushButton")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(730, 300, 701, 111))
font = QtGui.QFont()
font.setPointSize(18)
font.setBold(True)
font.setItalic(False)
font.setWeight(75)
self.label.setFont(font)
self.label.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label.setObjectName("label")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1920, 18))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)

self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label.setStyleSheet("background-color: rgba(0, 85, 127, 0);\n"
"color: rgb(255, 255, 255);")
self.pushButton.setText(_translate("MainWindow", "SCAN"))
self.label.setText(_translate("MainWindow", "WELCOME"))

self.pushButton.clicked.connect(self.copy)

def copy(self, MainWindow):
self.pushButton.setText('WORKING...')
self.pushButton.setStyleSheet("background-color: rgb(250, 0, 0);\n"
"color: rgb(255, 255, 255);")
testprompt=storeid=pyautogui.prompt(text='test', title='test')



class Application():
def run():
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())

Application.run()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help me

2019-08-06 Thread Brian Oney via Python-list
On Mon, 2019-08-05 at 21:10 +0430, arash kohansal wrote:
> Hello ive just installed python on my pc and ive already check the
> path
> choice part but microsoft visual code can not find it and it does not
> have
> the reload item

Check out: https://code.visualstudio.com/docs/languages/python

or

https://realpython.com/python-development-visual-studio-code/

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help me

2019-08-05 Thread MRAB

On 2019-08-05 17:40, arash kohansal wrote:

Hello ive just installed python on my pc and ive already check the path
choice part but microsoft visual code can not find it and it does not have
the reload item


1. Open Visual Studio Code.

2. Press F1, type "Python: Select Interpreter", and then press Enter.

3. Select the Python version that you installed from the list.
--
https://mail.python.org/mailman/listinfo/python-list


Please help me

2019-08-05 Thread arash kohansal
Hello ive just installed python on my pc and ive already check the path
choice part but microsoft visual code can not find it and it does not have
the reload item
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Want to learn python as I have donne manual testing for 12 years. Please help to share opinion how to start. Thanks

2019-07-15 Thread copeterson07
On Monday, July 15, 2019 at 12:44:20 AM UTC-6, kumar...@gmail.com wrote:
> Want to learn python as I have donne manual testing for 12 years. Please help 
> to share opinion how to start. Thanks

I don't know your skill level with programming, but I have found this 
https://www.learnpython.org/ website most useful. It allows you to get started 
quickly without having to setup a python development environment. 

If you are intending to do test automation, then I would also recommend 
learning https://robotframework.org/. The Gauge Test Framework is also valuable 
to learn https://gauge.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Want to learn python as I have donne manual testing for 12 years. Please help to share opinion how to start. Thanks

2019-07-15 Thread Aldwin Pollefeyt
Try to find small projects to solve with Python instead of using other
applications. Hereby my experience:

* solve or just represent a riddle or mathematical question.
  - Youtube channels called standupmaths and numberphile has some
interesting videos about algorithms. Then it's fun trying to build those
and see what happens. not only numerical results but also plot it into
graphs or create images from it
  - Every year General Intelligence and Security Service of the Netherlands
releases a series of puzzles around Christmas. It's fun to try to create
some decrypting tools around it and run them on top of the questions. Can
even automatically crawl over some wiki pages to create lists of names for
possible answers if you suspect it's a crossword full of encrypted nobel
prize winners.
  - or find some websites with riddles and crosswords or just on
hackerrank.com
* show headlines of a newspaper in the format you want in a terminal using
a rss feedparser
* a ubuntu desktop indicator with your favorite stock market price or
currency exchange or the time you logged into work in the morning
* write your own api or webservice around all info that you learned to
gather from multiple places
* a IRC bot that put's all the info of other scripts that interest you
(RSS, stock market, cpu usage, cheatsheets, python bugs, ...) on your own
IRC channel (.get stock_info || .get python_snippets strings) so you can
all info in one place
* write a part of a rubiks cube algorithm to understand the changing parts
to solve a small part
* solve a sudoku you had trouble with in the newspaper last week and still
bothers you
* start using some threading to solve puzzles faster if possible.
* send yourself a alert email when some disk is 80% full or when some idol
of you tweeted again
* just follow this mailing list or stackoverflow (python tags) and try to
understand the code examples that pass by ...

with just some daily tasks or solving questions, in the end, you learn
first some basic functions and algorithms, get some info from a webpage
(wiki) or a open api (weather info?), connect a socket to pass data, plot
some data on a chart/image, show info in your OS's status bar, write your
own api, threading, ...

On Mon, Jul 15, 2019 at 3:00 PM  wrote:

> Want to learn python as I have donne manual testing for 12 years. Please
> help to share opinion how to start. Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Want to learn python as I have donne manual testing for 12 years. Please help to share opinion how to start. Thanks

2019-07-15 Thread kumarscheen
Want to learn python as I have donne manual testing for 12 years. Please help 
to share opinion how to start. Thanks 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: can you please help me in opening the python programming.

2018-11-23 Thread Bob Gailer
We would be glad to help. I can't tell from your question what kind of help
you need so please give us more information.

Have you tried to install python?

If so has the installation succeeded?

What do you mean by "open the programming"?

What have you tried?

What do you expect to see?
-- 
https://mail.python.org/mailman/listinfo/python-list


can you please help me in opening the python programming.

2018-11-23 Thread hello!



Sent from Mail for Windows 10

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Jason Qian via Python-list
The message type is bytes,  this may make different ?

 print(type(message))



On Sun, Jan 28, 2018 at 8:41 PM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

> On Sun, 28 Jan 2018 20:31:39 -0500, Jason Qian via Python-list wrote:
>
> > Thanks a lot :)
> >
> > os.write(1, message)  works !
>
> I still do not believe that print(message) doesn't work. I can see no
> reason why you need to use os.write().
>
>
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Dan Stromberg
On Sun, Jan 28, 2018 at 6:04 PM, Steven D'Aprano
 wrote:
> On Sun, 28 Jan 2018 17:49:44 -0800, Dan Stromberg wrote:
> So what was the clue that it was bytes that you saw that (nearly)
> everyone else missed? Especially me.

Can I get away with saying "it was just a good guess"?

I've been using byte strings a bunch in one of my projects. That didn't hurt.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 17:49:44 -0800, Dan Stromberg wrote:

> On Sun, Jan 28, 2018 at 5:35 PM, Steven D'Aprano
>  wrote:
>> On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote:
>>> How about:
>> os.write(1, message)
>>
>> What do you think that will do that print() doesn't do?
> 
 message = b'*does not exist\r\n\tat com.*' 
 os.write(1, message)
> *does not exist
> at com.*26

 print(message)
> b'*does not exist\r\n\tat com.*'


What was the clue that made you think that Jason was using bytes? In his 
posts, he always said it was a string, and when he printed the repr() of 
the message, it was a string, not bytes. If it were bytes, we would have 
seen this:

py> message = b'*does not exist\r\n\tat com.*'
py> print(repr(message))
b'*does not exist\r\n\tat com.*'


That is NOT the output that Jason showed. His output was:

py> string_message = '*does not exist\r\n\tat com.*'
py> print(repr(string_message))
'*does not exist\r\n\tat com.*'


Ah wait no it wasn't even that. The output he showed had no quotation 
marks. I didn't pick up on that: what he sent us as supposed output was 
actually impossible. He has been editing the output.

So what was the clue that it was bytes that you saw that (nearly) 
everyone else missed? Especially me.


-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 19:51:06 -0500, Jason Qian via Python-list wrote:

> print(repr(message))  out :
> 
> *does not exist\r\n\tat com.*

For the record, I'd just like to say that this is not the output of 
Jason's call to print(). It has been edited to remove the 

b' '

delimiters which would have solved the problem: he isn't printing a 
string at all, he is printing bytes.

Jason, you have wasted our time by editing your output to hide what it 
actually shows. Don't do that again. When we ask to see the output of 
something, we need to see the ACTUAL output, not an edited version.


-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Dan Stromberg
On Sun, Jan 28, 2018 at 5:35 PM, Steven D'Aprano
 wrote:
> On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote:
>> How about:
> os.write(1, message)
>
> What do you think that will do that print() doesn't do?

>>> message = b'*does not exist\r\n\tat com.*'
>>> os.write(1, message)
*does not exist
at com.*26
>>> print(message)
b'*does not exist\r\n\tat com.*'
>>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 20:31:39 -0500, Jason Qian via Python-list wrote:

> Thanks a lot :)
> 
> os.write(1, message)  works !

I still do not believe that print(message) doesn't work. I can see no 
reason why you need to use os.write().




-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote:

> How about:
 os.write(1, message)


What do you think that will do that print() doesn't do?



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
Jason, your Python output and the C output are not the same.

Also, it looks like your email client is adding formatting codes to the 
email, or something. Please look at your post here:

https://mail.python.org/pipermail/python-list/2018-January/730384.html

Do you notice the extra asterisks added? I think they are added by your 
email program. Please do not use any formatting, they make the output 
confusing and make it difficult to understand what you are doing.

In Python, the output of print(repr(message)) looks like this:

does not exist\r\n\tat com.

(removing the asterisks at the start and end, which I believe are 
formatting added by to your email). That is, spelling it out character by 
character:

DE OH EE ES space EN OH TE space EE EX I ES TE backslash
AR backslash EN backslash TE AY TE space CE OH EM dot

That is what I expected. So if you print(message) without the repr, you 
should get exactly this:

does not exist
at com.



Here is the input and output of my Python session:

py> s = 'does not exist\r\n\tat com.'
py> print(s)
does not exist
at com.



That looks like exactly what you are expecting. If you are getting 
something different, please COPY AND PASTE as PLAIN TEXT (no formatting, 
no bold, no italics) the exact output from your Python session. And tell 
us what IDE you are using, or which interpreter. Are you using IDLE or 
PyCharm or Spyder or something else?

I repeat: do not add bold, or italics, do not use formatting of any kind. 
If you don't know how to turn the formatting off in your email program, 
you will need to find out.


You also print the individual characters of message from C:

for ch in message:
  printf("%d %c",ch, chr(ch))

and that outputs something completely different: the messages are not the 
same in your C code and your Python code.

Your Python code message is:

does not exist\r\n\tat com.


but your C code message appears to be:

not exist\r\n\tat com

(missing word "does" and final dot).

I do not understand why you are showing us C code. This is a Python 
forum, and you are having trouble printing from Python -- C is irrelevant.

I think you should just call print(message). If that doesn't do what you 
want, you need to show us what it actually does.



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Jason Qian via Python-list
Thanks Peter,

  replace print with os.write  fixed the problem.



On Sun, Jan 28, 2018 at 3:57 AM, Peter Otten <__pete...@web.de> wrote:

> Jason Qian via Python-list wrote:
>
> > HI
> >
> >I have a string that contains \r\n\t
> >
> >[Ljava.lang.Object; does not exist*\r\n\t*at
> >[com.livecluster.core.tasklet
> >
> >
> >I would like to  print it as :
> >
> > [Ljava.lang.Object; does not exist
> >  tat com.livecluster.core.tasklet
> >
> >   How can I do this in python print ?
>
> Assuming the string contains the escape sequences rather than an actual
> TAB, CR or NL you can apply codecs.decode():
>
> >>> s = r"[Ljava.lang.Object; does not exist\r\n\tat
> com.livecluster.core.tasklet"
> >>> print(s)
> [Ljava.lang.Object; does not exist\r\n\tat com.livecluster.core.tasklet
> >>> import codecs
> >>> print(codecs.decode(s, "unicode-escape"))
> [Ljava.lang.Object; does not exist
> at com.livecluster.core.tasklet
>
> Note that this will decode all escape sequences that may occur in a string
> literal
> in Python, e. g.
>
> >>> codecs.decode(r"\x09 \u03c0 \N{soft ice cream}", "unicode-escape")
> '\t π '
>
> and will complain when the string is not a valid Python string literal:
>
> >>> codecs.decode(r"\x", "unicode-escape")
> Traceback (most recent call last):
>   File "", line 1, in 
> UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position
> 0-1: truncated \xXX escape
>
> If you need more control you can build your own conversion routine:
>
> import re
>
> lookup = {
> "r": "\r",
> "n": "\n",
> "t": "\t",
> }
>
> def substitute(match):
> group = match.group(1)
> return lookup.get(group, group)
>
> def decode(s):
> return re.sub(r"\\(.)", substitute, s)
>
> s = decode("alpha\\n \\xomega")
> print(s)
> print(repr(s))
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Jason Qian via Python-list
Thanks a lot :)

os.write(1, message)  works !

On Sun, Jan 28, 2018 at 8:04 PM, Dan Stromberg  wrote:

> How about:
> >>> os.write(1, message)
>
> On Sun, Jan 28, 2018 at 4:51 PM, Jason Qian via Python-list
>  wrote:
> > print(repr(message))  out :
> >
> > *does not exist\r\n\tat com.*
> >
> >
> > for ch in message:
> >   printf("%d %c",ch, chr(ch))
> >
> >
> > %d %c 110 n
> > %d %c 111 o
> > %d %c 116 t
> > %d %c 32
> > %d %c 101 e
> > %d %c 120 x
> > %d %c 105 i
> > %d %c 115 s
> > %d %c 116 t
> >
> > *%d %c 13%d %c 10*
> > *%d %c 9*
> > %d %c 97 a
> > %d %c 116 t
> > %d %c 32
> > %d %c 99 c
> > %d %c 111 o
> > %d %c 109 m
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Dan Stromberg
How about:
>>> os.write(1, message)

On Sun, Jan 28, 2018 at 4:51 PM, Jason Qian via Python-list
 wrote:
> print(repr(message))  out :
>
> *does not exist\r\n\tat com.*
>
>
> for ch in message:
>   printf("%d %c",ch, chr(ch))
>
>
> %d %c 110 n
> %d %c 111 o
> %d %c 116 t
> %d %c 32
> %d %c 101 e
> %d %c 120 x
> %d %c 105 i
> %d %c 115 s
> %d %c 116 t
>
> *%d %c 13%d %c 10*
> *%d %c 9*
> %d %c 97 a
> %d %c 116 t
> %d %c 32
> %d %c 99 c
> %d %c 111 o
> %d %c 109 m
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Jason Qian via Python-list
print(repr(message))  out :

*does not exist\r\n\tat com.*


for ch in message:
  printf("%d %c",ch, chr(ch))


%d %c 110 n
%d %c 111 o
%d %c 116 t
%d %c 32
%d %c 101 e
%d %c 120 x
%d %c 105 i
%d %c 115 s
%d %c 116 t

*%d %c 13%d %c 10*
*%d %c 9*
%d %c 97 a
%d %c 116 t
%d %c 32
%d %c 99 c
%d %c 111 o
%d %c 109 m





On Sun, Jan 28, 2018 at 9:50 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

> On Sat, 27 Jan 2018 21:23:02 -0500, Jason Qian via Python-list wrote:
>
> > there are 0D 0A 09
>
> If your string actually contains CARRIAGE RETURN (OD) NEWLINE (OA), and
> TAB (09) characters, then you don't need to do anything. Just call print,
> and they will be printed correctly.
>
> If that doesn't work, then your input string doesn't contain what you
> think it contains. Please call this:
>
> print(repr(the_string))
>
> and COPY AND PASTE the output here so we can see it.
>
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 21:23:02 -0500, Jason Qian via Python-list wrote:

> there are 0D 0A 09

If your string actually contains CARRIAGE RETURN (OD) NEWLINE (OA), and 
TAB (09) characters, then you don't need to do anything. Just call print, 
and they will be printed correctly.

If that doesn't work, then your input string doesn't contain what you 
think it contains. Please call this:

print(repr(the_string))

and COPY AND PASTE the output here so we can see it.



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Peter Otten
Jason Qian via Python-list wrote:

> HI
> 
>I have a string that contains \r\n\t
> 
>[Ljava.lang.Object; does not exist*\r\n\t*at
>[com.livecluster.core.tasklet
> 
> 
>I would like to  print it as :
> 
> [Ljava.lang.Object; does not exist
>  tat com.livecluster.core.tasklet
> 
>   How can I do this in python print ?

Assuming the string contains the escape sequences rather than an actual
TAB, CR or NL you can apply codecs.decode():

>>> s = r"[Ljava.lang.Object; does not exist\r\n\tat 
com.livecluster.core.tasklet"
>>> print(s)
[Ljava.lang.Object; does not exist\r\n\tat com.livecluster.core.tasklet
>>> import codecs
>>> print(codecs.decode(s, "unicode-escape"))
[Ljava.lang.Object; does not exist
at com.livecluster.core.tasklet

Note that this will decode all escape sequences that may occur in a string 
literal
in Python, e. g.

>>> codecs.decode(r"\x09 \u03c0 \N{soft ice cream}", "unicode-escape")
'\t π '

and will complain when the string is not a valid Python string literal:

>>> codecs.decode(r"\x", "unicode-escape")
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 
0-1: truncated \xXX escape

If you need more control you can build your own conversion routine:

import re

lookup = {
"r": "\r",
"n": "\n",
"t": "\t",
}

def substitute(match):
group = match.group(1)
return lookup.get(group, group)

def decode(s):
return re.sub(r"\\(.)", substitute, s)

s = decode("alpha\\n \\xomega")
print(s)
print(repr(s))


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread breamoreboy
On Saturday, January 27, 2018 at 8:16:58 PM UTC, Jason Qian wrote:
> HI
> 
>I am a string that contains \r\n\t
> 
>[Ljava.lang.Object; does not exist*\r\n\t*at com.livecluster.core.tasklet
> 
>I would like it print as :
> 
> [Ljava.lang.Object; does not exist
>   tat com.livecluster.core.tasklet

Unless I've missed something just call print on the string.

>>> print('[Ljava.lang.Object; does not exist*\r\n\t*at 
>>> com.livecluster.core.tasklet')
[Ljava.lang.Object; does not exist*
*at com.livecluster.core.tasklet

--
Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Prahallad Achar
In python 3. X
Use. Decode and. Encode

On 28 Jan 2018 1:47 am, "Jason Qian via Python-list" 
wrote:

> HI
>
>I am a string that contains \r\n\t
>
>[Ljava.lang.Object; does not exist*\r\n\t*at
> com.livecluster.core.tasklet
>
>
>I would like it print as :
>
> [Ljava.lang.Object; does not exist
>   tat com.livecluster.core.tasklet
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Jason Qian via Python-list
there are 0D 0A 09

%c %d  116


*%c %d  13%c %d  10%c %d
 9*
%c %d  97


On Sat, Jan 27, 2018 at 9:05 PM, Dennis Lee Bieber 
wrote:

> On Sat, 27 Jan 2018 20:33:58 -0500, Jason Qian via Python-list
>  declaimed the following:
>
> >  Ljava.lang.Object; does not exist*\r\n\t*at com
> >
>
> Does that source contain
>
> 0x0d 0x0a 0x09
>   
>
> or is it really
>
> 0x5c 0x72 0x5c 0x61 0x5c 0x74
> \r\n\t
>
> as individual characters?
>
>
> >>> bks = chr(0x5c)
> >>> ar = "r"
> >>> en = "n"
> >>> te = "t"
> >>>
> >>> strn = "".join([bks, ar, bks, en, bks, te])
> >>> strn
> '\\r\\n\\t'
> >>> print strn
> \r\n\t
> >>> cstr = "\r\n\t"
> >>> cstr
> '\r\n\t'
> >>> print cstr
>
>
> >>>
>
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Jason Qian via Python-list
Thanks for taking look this.


The source of the string is std::string from our c code as callback .
On the python side is shows as bytes.

Is there way we can reformat the string that replace \r\n with newline, so
python can correctly print it ?

Thanks

On Sat, Jan 27, 2018 at 5:39 PM, Terry Reedy  wrote:

> On 1/27/2018 3:15 PM, Jason Qian via Python-list wrote:
>
>> HI
>>
>> I am a string that contains \r\n\t
>>
>> [Ljava.lang.Object; does not exist*\r\n\t*at
>> com.livecluster.core.tasklet
>>
>>
>> I would like it print as :
>>
>> [Ljava.lang.Object; does not exist
>>tat com.livecluster.core.tasklet
>>
>
> Your output does not match the input.  Don't add, or else remove, the *s
> if you don't want to see them.  Having '\t' print as '  t' makes no sense.
>
> In IDLE
>
> >>> print('[Ljava.lang.Object; does not exist*\r\n\t*at
> com.livecluster.core.tasklet')
> [Ljava.lang.Object; does not exist*
> *at com.livecluster.core.tasklet
>
> IDLE ignores \r, other display mechanisms may not.  You generally should
> not use it.
>
> Pasting the text, with the literal newline embedded, does not work in
> Windows interactive interpreter, so not testing this there.
>
>
> --
> Terry Jan Reedy
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Jason Qian via Python-list
Thanks for taking look this.

1. Python pass a function to c side as callback, and print out the message.

def handleError(message, code):
 print('** handleError **')
* print('exception ' + str(message))*

2. On c side : send stack trace back to python by calling the callback
function

Callback::Callback(InvocationER rcb)
:
_rcb(rcb)
{
}
void Callback::handleError(Exception , int taskId) {
 *(_rcb)((char*)e.getStackTrace().c_str(), taskId);*
}


So, the source of the string is std::string. On the python side is byte
array.

  Ljava.lang.Object; does not exist*\r\n\t*at com

Thanks




On Sat, Jan 27, 2018 at 4:20 PM, Ned Batchelder 
wrote:

> On 1/27/18 3:15 PM, Jason Qian via Python-list wrote:
>
>> HI
>>
>> I am a string that contains \r\n\t
>>
>> [Ljava.lang.Object; does not exist*\r\n\t*at
>> com.livecluster.core.tasklet
>>
>>
>> I would like it print as :
>>
>> [Ljava.lang.Object; does not exist
>>tat com.livecluster.core.tasklet
>>
>
> It looks like you are doing something that is a little bit, and perhaps a
> lot, more complicated than printing a string.  Can you share the code that
> is trying to produce that output?
>
> --Ned.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Terry Reedy

On 1/27/2018 3:15 PM, Jason Qian via Python-list wrote:

HI

I am a string that contains \r\n\t

[Ljava.lang.Object; does not exist*\r\n\t*at com.livecluster.core.tasklet


I would like it print as :

[Ljava.lang.Object; does not exist
   tat com.livecluster.core.tasklet


Your output does not match the input.  Don't add, or else remove, the *s 
if you don't want to see them.  Having '\t' print as '  t' makes no sense.


In IDLE

>>> print('[Ljava.lang.Object; does not exist*\r\n\t*at 
com.livecluster.core.tasklet')

[Ljava.lang.Object; does not exist*
*at com.livecluster.core.tasklet

IDLE ignores \r, other display mechanisms may not.  You generally should 
not use it.


Pasting the text, with the literal newline embedded, does not work in 
Windows interactive interpreter, so not testing this there.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Ned Batchelder

On 1/27/18 3:15 PM, Jason Qian via Python-list wrote:

HI

I am a string that contains \r\n\t

[Ljava.lang.Object; does not exist*\r\n\t*at com.livecluster.core.tasklet


I would like it print as :

[Ljava.lang.Object; does not exist
   tat com.livecluster.core.tasklet


It looks like you are doing something that is a little bit, and perhaps 
a lot, more complicated than printing a string.  Can you share the code 
that is trying to produce that output?


--Ned.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Jason Qian via Python-list
HI

   I have a string that contains \r\n\t

   [Ljava.lang.Object; does not exist*\r\n\t*at com.livecluster.core.tasklet


   I would like to  print it as :

[Ljava.lang.Object; does not exist
 tat com.livecluster.core.tasklet

  How can I do this in python print ?


Thanks

On Sat, Jan 27, 2018 at 3:15 PM, Jason Qian  wrote:

> HI
>
>I am a string that contains \r\n\t
>
>[Ljava.lang.Object; does not exist*\r\n\t*at
> com.livecluster.core.tasklet
>
>
>I would like it print as :
>
> [Ljava.lang.Object; does not exist
>   tat com.livecluster.core.tasklet
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Please help on print string that contains 'tab' and 'newline'

2018-01-27 Thread Jason Qian via Python-list
HI

   I am a string that contains \r\n\t

   [Ljava.lang.Object; does not exist*\r\n\t*at com.livecluster.core.tasklet


   I would like it print as :

[Ljava.lang.Object; does not exist
  tat com.livecluster.core.tasklet
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please Help

2018-01-26 Thread Gary Herron



On 01/26/2018 08:33 PM, mohammedfaraz...@gmail.com wrote:

import numpy as np
x=np.unit8([250)
print(x)
y=np.unit8([10])
print(y)
z=x+y
print(z)


output

[250]
[10]
[4]

My question how is z [4]


Despite all the typos in your post, you appear to be doing 8 bit 
unsigned arithmetic.  Do you know what that means?  The answer you might 
have expected (i.e. 260) does not fit in the 0 ... 255 range of 8 bits, 
and so the result has overflowed and "wrapped around" to produce 4.


Try this for a simpler example of the same:
>>> np.uint8(260)
4


Gary Herron


--
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418

--
https://mail.python.org/mailman/listinfo/python-list


Re: Please Help

2018-01-26 Thread jladasky
Please copy and paste the exact code you are running.  The code you show has 
several syntax errors, and would not execute at all.

Now, I think that I can read through your errors anyway, so let me ask you a 
question: what is the largest possible value that can be represented with an 
unsigned 8-bit integer?

-- 
https://mail.python.org/mailman/listinfo/python-list


Please Help

2018-01-26 Thread mohammedfarazali
import numpy as np
x=np.unit8([250)
print(x)
y=np.unit8([10])
print(y)
z=x+y
print(z)


output

[250]
[10]
[4]

My question how is z [4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RegExp - please help me!

2017-12-27 Thread szykcech
> (?s)struct (.+?)\s*\{\s*(.+?)\s*\};

Thank you Vlastimil Brom for regexp and for explanation!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RegExp - please help me!

2017-12-27 Thread Lele Gaifax
szykc...@gmail.com writes:

> Please help me with this regexp or tell me that I neeed do this in other way.

I think that using regexps to parse those structures is fragile and difficult
to get right[0], as there are lots of corner cases (comments, complex types,
...).

I'd suggest using a tool designed to do that, for example pycparser[1], that
provides the required infrastructure to parse C units into an AST: from there
you can easily extract interesting pieces and write out in whatever format you
need.

As an example, I used it to extract[2] enums and defines from PostgreSQL C
headers[3] and rewrite them as Python definitions[4].

Good luck,
ciao, lele.

[0] http://regex.info/blog/2006-09-15/247
[1] https://github.com/eliben/pycparser
[2] https://github.com/lelit/pg_query/blob/master/tools/extract_enums.py
[3] 
https://github.com/lfittl/libpg_query/blob/43ce2e8cdf54e4e1e8b0352e37adbd72e568e100/src/postgres/include/nodes/parsenodes.h
[4] https://github.com/lelit/pg_query/blob/master/pg_query/enums/parsenodes.py
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RegExp - please help me! (Posting On Python-List Prohibited)

2017-12-26 Thread szykcech
W dniu wtorek, 26 grudnia 2017 21:53:14 UTC+1 użytkownik Lawrence D’Oliveiro 
napisał:
> On Wednesday, December 27, 2017 at 2:15:21 AM UTC+13, szyk...@gmail.com wrote:
> > struct (.+)\s*{\s*(.+)\s*};
> 
> You realize that “.” matches anything? Whereas I think you want to match 
> non-whitespace in those places.

I realize that. I want skip white-spaces from the beginning and from the end 
and match entire body of C++ struct declaration (with white spaces inside as 
well). Maybe should I use "".strip(" ").strip("\t").strip("\n") function after 
matching?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RegExp - please help me!

2017-12-26 Thread Peter Pearson
On Tue, 26 Dec 2017 05:14:55 -0800 (PST), szykc...@gmail.com wrote:
[snip]
> So: I develop regexp which to my mind should work, but it doesn't and
> I don't know why. The broken regexp is like this: 
> struct (.+)\s*{\s*(.+)\s*};
[snip]

You'll probably get better help faster if you can present your problem
as a couple lines of code, and ask "Why does this print XXX, when I'm
expecting it to print YYY?"  (Sorry I'm not smart enough to give you
an answer to your actual question.)

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: RegExp - please help me!

2017-12-26 Thread Vlastimil Brom
Hi,
I can't comment, whether this is the right approach, as I have no
experiences with C++, but for the matching regular expression itself,
I believe, e.g. the following might work for your sample data (I am
not sure, however, what other details or variants should be taken into
account):

(?s)struct (.+?)\s*\{\s*(.+?)\s*\};

i.e. you need to escape the metacharacters { } with a backslash \
and in the current form of the pattern, you also need the flag DOTALL
- set via (?s) in the example above - in order to also match newlines
with . (alternatively, you could use \n specifically in the pattern,
where needed.) it is possible, that an online regex tester uses some
flags implicitly.

I believe, the non-greedy quantifiers are suitable here  +?
matching as little as possible, otherwise the pattern would match
between the first and the last structs in the source text at once.

It seems, the multiline flag is not needed here, as there are no
affected metacharacters.

hth,
   vbr

=

2017-12-26 14:14 GMT+01:00, szykc...@gmail.com <szykc...@gmail.com>:
> Hi
> I use online Python reg exp editor https://pythex.org/ and I use option
> "multiline".
> I want to use my reg exp in Python script to generate automatically some
> part of my program written in C++ (database structure and serialization
> functions). In order to do this I need: 1) C++ struct name and 2) struct
> definition. Struct definition I need because some inline functions can
> appear bellow my struct definition and makes inappropriate further regexp
> filtering (against variables).
>
> So: I develop regexp which to my mind should work, but it doesn't and I
> don't know why. The broken regexp is like this:
> struct (.+)\s*{\s*(.+)\s*};
> As you can see it has two groups: struct name and struct definition.
> It fails even for such simple structure:
> struct Structure
> {
> int mVariable1;
> QString mVariable2;
> bool mVariable3
> };
>
> Please help me with this regexp or tell me that I neeed do this in other
> way.
>
> thanks, happy Christmas, and happy New Year
> Szyk Cech
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


RegExp - please help me!

2017-12-26 Thread szykcech
Hi
I use online Python reg exp editor https://pythex.org/ and I use option 
"multiline".
I want to use my reg exp in Python script to generate automatically some part 
of my program written in C++ (database structure and serialization functions). 
In order to do this I need: 1) C++ struct name and 2) struct definition. Struct 
definition I need because some inline functions can appear bellow my struct 
definition and makes inappropriate further regexp filtering (against variables).

So: I develop regexp which to my mind should work, but it doesn't and I don't 
know why. The broken regexp is like this:
struct (.+)\s*{\s*(.+)\s*};
As you can see it has two groups: struct name and struct definition.
It fails even for such simple structure:
struct Structure
{
int mVariable1;
QString mVariable2;
bool mVariable3
};

Please help me with this regexp or tell me that I neeed do this in other way.

thanks, happy Christmas, and happy New Year
Szyk Cech
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error In querying Genderize.io. Can someone please help

2016-12-01 Thread John Gordon
In  handa...@gmail.com 
writes:

> import requests
> import json
> names={'katty','Shean','Rajat'};
> for name in names:
> request_string="http://api.genderize.io/?"+name
> r=requests.get(request_string)
> result=json.loads(r.content)

You're using http: instead of https:, and you're using ?katty instead
of ?name=katty, and therefore the host does not recognize your request
as an API call and redirects you to the normal webpage.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

-- 
https://mail.python.org/mailman/listinfo/python-list


Error In querying Genderize.io. Can someone please help

2016-12-01 Thread handar94
import requests
import json
names={'katty','Shean','Rajat'};
for name in names:
request_string="http://api.genderize.io/?"+name
r=requests.get(request_string)
result=json.loads(r.content)


Error---
Traceback (most recent call last):
  File "C:/Users/user/PycharmProjects/untitled7/Mis1.py", line 7, in 
result=json.loads(r.content)
  File "C:\Users\user\Anaconda2\lib\json\__init__.py", line 339, in loads
return _default_decoder.decode(s)
  File "C:\Users\user\Anaconda2\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\user\Anaconda2\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Can someone please help.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-27 Thread Michael Torrie
On 05/27/2016 08:09 PM, Michael Torrie wrote:
> On 05/27/2016 08:41 AM, Sean Son wrote:
>> Thank you for your reply. So the error isnt due to a bug in function
>> itself? It is due to a possible error in the Android APK file?  If that
>> is the case, it would take a while to figure this out. I tried contacted
>> the author of the project but I have yet to hear back from him .
> 
> Yes it sounds like a bug, but the bug is probably not in the function
> that you pointed to.  The exception occurs there, yes, but it occurs
> because the function is expecting an integer to be passed to it, but is
> receiving a string instead.  In other words, something is passing bad
> data (or data the function doesn't know how to interpret).  

I guess I don't mean integer.  I mean it expects a string that can be
converted to an integer.  But it's getting some other text instead,
which it doesn't know how to handle.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-27 Thread Michael Torrie
On 05/27/2016 08:41 AM, Sean Son wrote:
> Thank you for your reply. So the error isnt due to a bug in function
> itself? It is due to a possible error in the Android APK file?  If that
> is the case, it would take a while to figure this out. I tried contacted
> the author of the project but I have yet to hear back from him .

Yes it sounds like a bug, but the bug is probably not in the function
that you pointed to.  The exception occurs there, yes, but it occurs
because the function is expecting an integer to be passed to it, but is
receiving a string instead.  In other words, something is passing bad
data (or data the function doesn't know how to interpret).  Debuggers
and Python are not my strong points, but if you could go back through
the stack trace and find out what's calling it, you might be able to
find out where this bad data is coming from.  I doubt it's an error in
the apk.  More likely Google has changed something inside of apks and
the python code hasn't been updated to account for this.  Could be
something in the XML manifest inside the apk.  Just shooting in the dark
there.  Not so helpful, but that's all I know really.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-27 Thread Sean Son
Hello

Thank you for your reply. So the error isnt due to a bug in function
itself? It is due to a possible error in the Android APK file?  If that is
the case, it would take a while to figure this out. I tried contacted the
author of the project but I have yet to hear back from him .

Thanks



On Thu, May 26, 2016 at 8:31 PM, Michael Torrie  wrote:

> On 05/26/2016 05:57 PM, Michael Torrie wrote:
> > You could try emailing the author who's email address is listed on the
> > project's main github page.  I suspect the project itself is abandoned.
>
> Ahem. That should have been whose. Sigh.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Michael Torrie
On 05/26/2016 05:57 PM, Michael Torrie wrote:
> You could try emailing the author who's email address is listed on the
> project's main github page.  I suspect the project itself is abandoned.

Ahem. That should have been whose. Sigh.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Michael Torrie
On 05/26/2016 11:31 AM, Sean Son wrote:
> Hopefully those help in any troubleshooting steps that you all recommend to
> me!
> 
> Thank you!

You could try emailing the author who's email address is listed on the
project's main github page.  I suspect the project itself is abandoned.

Was this working before and is no longer working?  What brought about
the change? A new version of Android?  A new version of this program?
Seems like this github project is abandoned and, as you have found,
bitrotting as Android moves on and likely causes incompatibilities with
it as time goes on.

Unless the author can advise you, help may be hard to come by.  The
error itself is simple enough.  But what is feeding bad data to this
function (a string instead of a number) is unknown and would take some
effort to get to the bottom of it, especially by any of us who have
never seen this code before, and many of whom haven't ever worked with
Android before.

If this particular program is critical to your employer's business,
consider offering the original author (or folks on this list) some
payment for the fix.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Sean Son
Here are the links to the other scripts mentioned in the error messages:

https://github.com/mz/androwarn/blob/master/androwarn/search/malicious_behaviours/device_settings.py

https://github.com/mz/androwarn/blob/master/androwarn/analysis/analysis.py

and the main androwarn.py script:

https://github.com/mz/androwarn/blob/master/androwarn.py

Hopefully those help in any troubleshooting steps that you all recommend to
me!

Thank you!

On Thu, May 26, 2016 at 1:25 PM, Sean Son 
wrote:

> Hello all
>
> From what I can tell from the error message that I received, line 257 of
> the util.py script is causing the error.  Here is a link to this script:
>
> https://github.com/mz/androwarn/blob/master/androwarn/util/util.py
>
> I am not a python developer myself, unfortunately, so I have no idea how I
> should fix this error.  All help is greatly appreciated!
>
> Thanks
>
> On Tue, May 24, 2016 at 3:46 PM, Sean Son <
> linuxmailinglistsem...@gmail.com> wrote:
>
>> Thanks for the reply.
>>
>> Looks like I am screwed on this one lol
>>
>> On Tue, May 24, 2016 at 3:31 PM, MRAB  wrote:
>>
>>> On 2016-05-24 20:04, Sean Son wrote:
>>>
 hello all

 I am testing out a script called androwarn.py, which I downloaded from:

 https://github.com/mz/androwarn

 using the instructions found on:

 https://github.com/mz/androwarn/wiki/Installation

 When I ran the following commands to test the APK for AirBNB:


  python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3
 -r
 html -n


 I received the following errors:

 Traceback (most recent call last):
   File "androwarn.py", line 116, in 
 main(options, arguments)
   File "androwarn.py", line 99, in main
 data = perform_analysis(APK_FILE, a, d, x, no_connection)
   File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115,
 in
 perform_analysis
 ( 'device_settings_harvesting',
 gather_device_settings_harvesting(x) ),
   File

 "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
 line 96, in gather_device_settings_harvesting
 result.extend( detect_get_package_info(x) )
   File

 "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
 line 79, in detect_get_package_info
 flags = recover_bitwise_flag_settings(flag,
 PackageManager_PackageInfo)
   File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
 recover_bitwise_flag_settings
 if (int(flag) & option_value) == option_value :
 ValueError: invalid literal for int() with base 10:

 'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'


 I am absolutely at a loss as to how I should fix these errors? Anyone
 have
 any ideas? Sorry for just throwing this at you guys without warning, but
 Ive been tasked with fixing this at work and I need assistance please!

 It looks like this issue:
>>>
>>> https://github.com/mz/androwarn/issues/10
>>>
>>> dating from 11 Dec 2014 and as yet unanswered.
>>>
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-26 Thread Sean Son
Hello all

>From what I can tell from the error message that I received, line 257 of
the util.py script is causing the error.  Here is a link to this script:

https://github.com/mz/androwarn/blob/master/androwarn/util/util.py

I am not a python developer myself, unfortunately, so I have no idea how I
should fix this error.  All help is greatly appreciated!

Thanks

On Tue, May 24, 2016 at 3:46 PM, Sean Son 
wrote:

> Thanks for the reply.
>
> Looks like I am screwed on this one lol
>
> On Tue, May 24, 2016 at 3:31 PM, MRAB  wrote:
>
>> On 2016-05-24 20:04, Sean Son wrote:
>>
>>> hello all
>>>
>>> I am testing out a script called androwarn.py, which I downloaded from:
>>>
>>> https://github.com/mz/androwarn
>>>
>>> using the instructions found on:
>>>
>>> https://github.com/mz/androwarn/wiki/Installation
>>>
>>> When I ran the following commands to test the APK for AirBNB:
>>>
>>>
>>>  python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3 -r
>>> html -n
>>>
>>>
>>> I received the following errors:
>>>
>>> Traceback (most recent call last):
>>>   File "androwarn.py", line 116, in 
>>> main(options, arguments)
>>>   File "androwarn.py", line 99, in main
>>> data = perform_analysis(APK_FILE, a, d, x, no_connection)
>>>   File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115,
>>> in
>>> perform_analysis
>>> ( 'device_settings_harvesting',
>>> gather_device_settings_harvesting(x) ),
>>>   File
>>>
>>> "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
>>> line 96, in gather_device_settings_harvesting
>>> result.extend( detect_get_package_info(x) )
>>>   File
>>>
>>> "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
>>> line 79, in detect_get_package_info
>>> flags = recover_bitwise_flag_settings(flag,
>>> PackageManager_PackageInfo)
>>>   File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
>>> recover_bitwise_flag_settings
>>> if (int(flag) & option_value) == option_value :
>>> ValueError: invalid literal for int() with base 10:
>>>
>>> 'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'
>>>
>>>
>>> I am absolutely at a loss as to how I should fix these errors? Anyone
>>> have
>>> any ideas? Sorry for just throwing this at you guys without warning, but
>>> Ive been tasked with fixing this at work and I need assistance please!
>>>
>>> It looks like this issue:
>>
>> https://github.com/mz/androwarn/issues/10
>>
>> dating from 11 Dec 2014 and as yet unanswered.
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-24 Thread Sean Son
Thanks for the reply.

Looks like I am screwed on this one lol

On Tue, May 24, 2016 at 3:31 PM, MRAB  wrote:

> On 2016-05-24 20:04, Sean Son wrote:
>
>> hello all
>>
>> I am testing out a script called androwarn.py, which I downloaded from:
>>
>> https://github.com/mz/androwarn
>>
>> using the instructions found on:
>>
>> https://github.com/mz/androwarn/wiki/Installation
>>
>> When I ran the following commands to test the APK for AirBNB:
>>
>>
>>  python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3 -r
>> html -n
>>
>>
>> I received the following errors:
>>
>> Traceback (most recent call last):
>>   File "androwarn.py", line 116, in 
>> main(options, arguments)
>>   File "androwarn.py", line 99, in main
>> data = perform_analysis(APK_FILE, a, d, x, no_connection)
>>   File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115, in
>> perform_analysis
>> ( 'device_settings_harvesting',
>> gather_device_settings_harvesting(x) ),
>>   File
>>
>> "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
>> line 96, in gather_device_settings_harvesting
>> result.extend( detect_get_package_info(x) )
>>   File
>>
>> "/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
>> line 79, in detect_get_package_info
>> flags = recover_bitwise_flag_settings(flag,
>> PackageManager_PackageInfo)
>>   File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
>> recover_bitwise_flag_settings
>> if (int(flag) & option_value) == option_value :
>> ValueError: invalid literal for int() with base 10:
>>
>> 'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'
>>
>>
>> I am absolutely at a loss as to how I should fix these errors? Anyone have
>> any ideas? Sorry for just throwing this at you guys without warning, but
>> Ive been tasked with fixing this at work and I need assistance please!
>>
>> It looks like this issue:
>
> https://github.com/mz/androwarn/issues/10
>
> dating from 11 Dec 2014 and as yet unanswered.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Strange Python related errors for androwarn.py. Please help!

2016-05-24 Thread MRAB

On 2016-05-24 20:04, Sean Son wrote:

hello all

I am testing out a script called androwarn.py, which I downloaded from:

https://github.com/mz/androwarn

using the instructions found on:

https://github.com/mz/androwarn/wiki/Installation

When I ran the following commands to test the APK for AirBNB:


 python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3 -r
html -n


I received the following errors:

Traceback (most recent call last):
  File "androwarn.py", line 116, in 
main(options, arguments)
  File "androwarn.py", line 99, in main
data = perform_analysis(APK_FILE, a, d, x, no_connection)
  File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115, in
perform_analysis
( 'device_settings_harvesting',
gather_device_settings_harvesting(x) ),
  File
"/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
line 96, in gather_device_settings_harvesting
result.extend( detect_get_package_info(x) )
  File
"/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
line 79, in detect_get_package_info
flags = recover_bitwise_flag_settings(flag, PackageManager_PackageInfo)
  File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
recover_bitwise_flag_settings
if (int(flag) & option_value) == option_value :
ValueError: invalid literal for int() with base 10:
'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'


I am absolutely at a loss as to how I should fix these errors? Anyone have
any ideas? Sorry for just throwing this at you guys without warning, but
Ive been tasked with fixing this at work and I need assistance please!


It looks like this issue:

https://github.com/mz/androwarn/issues/10

dating from 11 Dec 2014 and as yet unanswered.

--
https://mail.python.org/mailman/listinfo/python-list


Strange Python related errors for androwarn.py. Please help!

2016-05-24 Thread Sean Son
hello all

I am testing out a script called androwarn.py, which I downloaded from:

https://github.com/mz/androwarn

using the instructions found on:

https://github.com/mz/androwarn/wiki/Installation

When I ran the following commands to test the APK for AirBNB:


 python androwarn.py -i SampleApplication/bin/"Airbnb 5.19.0.apk" -v 3 -r
html -n


I received the following errors:

Traceback (most recent call last):
  File "androwarn.py", line 116, in 
main(options, arguments)
  File "androwarn.py", line 99, in main
data = perform_analysis(APK_FILE, a, d, x, no_connection)
  File "/home/dost/androwarn/androwarn/analysis/analysis.py", line 115, in
perform_analysis
( 'device_settings_harvesting',
gather_device_settings_harvesting(x) ),
  File
"/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
line 96, in gather_device_settings_harvesting
result.extend( detect_get_package_info(x) )
  File
"/home/dost/androwarn/androwarn/search/malicious_behaviours/device_settings.py",
line 79, in detect_get_package_info
flags = recover_bitwise_flag_settings(flag, PackageManager_PackageInfo)
  File "/home/dost/androwarn/androwarn/util/util.py", line 257, in
recover_bitwise_flag_settings
if (int(flag) & option_value) == option_value :
ValueError: invalid literal for int() with base 10:
'Lcom/google/android/gms/common/GooglePlayServicesUtil;->zzad(Landroid/content/Context;)V'


I am absolutely at a loss as to how I should fix these errors? Anyone have
any ideas? Sorry for just throwing this at you guys without warning, but
Ive been tasked with fixing this at work and I need assistance please!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Joel Goldstick
On Sat, Mar 26, 2016 at 1:31 AM, Juan Dent <juand...@mac.com> wrote:

>
> I am trying to run ‘python cppdep.py’ but get the following:
>
>
> 
> analyzing dependencies among all components ...
> Traceback (most recent call last):
>   File "cppdep.py", line 675, in 
> main()
>   File "cppdep.py", line 643, in main
> calculate_graph(digraph)
>   File "cppdep.py", line 570, in calculate_graph
> (cycles, dict_node2cycle) = make_DAG(digraph, key_node)
>   File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79,
> in make_DAG
> for ind in range(len(subgraphs)-1, -1, -1):
> TypeError: object of type 'generator' has no len()
>
>
> Please, I know no python and am in a hurry to get this working… Please help
>
>
> Regards,
> Juan
> --
> https://mail.python.org/mailman/listinfo/python-list
>

As a painless quick try I would change this line:

for ind in range(len(subgraphs)-1, -1, -1):

to this:

for ind in range(len(list(subgraphs))-1, -1, -1):

If that works, when you have time track down what is really going on.
-- 
Joel Goldstick
http://joelgoldstick.com/ <http://joelgoldstick.com/stats/birthdays>
http://cc-baseballstats.info/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Gary Herron

On 03/25/2016 10:31 PM, Juan Dent wrote:

I am trying to run ‘python cppdep.py’ but get the following:


 I would guess that this code was written some time ago for Python2, 
but that you have downloaded and run it with Python3.


Try installing Python2 instead of Python3.   Or try talking whoever 
wrote it into converting it to Python3.


Or my guess is completely wrong and the code is buggy and won't run 
until fixed.  (Which brings up the questions: What is cppdep.py? Who 
wrote it?  How do you know that it runs?)



Gary Herron





analyzing dependencies among all components ...
Traceback (most recent call last):
   File "cppdep.py", line 675, in 
 main()
   File "cppdep.py", line 643, in main
 calculate_graph(digraph)
   File "cppdep.py", line 570, in calculate_graph
 (cycles, dict_node2cycle) = make_DAG(digraph, key_node)
   File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79, in 
make_DAG
 for ind in range(len(subgraphs)-1, -1, -1):
TypeError: object of type 'generator' has no len()


Please, I know no python and am in a hurry to get this working… Please help


Regards,
Juan



--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418


--
https://mail.python.org/mailman/listinfo/python-list


Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Ned Batchelder
On Saturday, March 26, 2016 at 5:59:30 AM UTC-4, Juan Dent wrote:
> I am trying to run 'python cppdep.py' but get the following:
> 
> 
> analyzing dependencies among all components ...
> Traceback (most recent call last):
>   File "cppdep.py", line 675, in 
> main()
>   File "cppdep.py", line 643, in main
> calculate_graph(digraph)
>   File "cppdep.py", line 570, in calculate_graph
> (cycles, dict_node2cycle) = make_DAG(digraph, key_node)
>   File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79, in 
> make_DAG
> for ind in range(len(subgraphs)-1, -1, -1):
> TypeError: object of type 'generator' has no len()
> 
> 
> Please, I know no python and am in a hurry to get this working... Please help

It looks like you are not the first to encounter this:
https://github.com/yuzhichang/cppdep/issues/2

I don't see a quick fix to this in the code.  If you fix this one spot,
likely there will be other problem.

It looks to me like you should install NetworkX 1.7 to get it to work.

--Ned.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Steven D'Aprano
On Sat, 26 Mar 2016 04:31 pm, Juan Dent wrote:

> 
> I am trying to run ‘python cppdep.py’ but get the following:
> 
>

> analyzing dependencies among all components ...
> Traceback (most recent call last):
>   File "cppdep.py", line 675, in 
> main()
>   File "cppdep.py", line 643, in main
> calculate_graph(digraph)
>   File "cppdep.py", line 570, in calculate_graph
> (cycles, dict_node2cycle) = make_DAG(digraph, key_node)
>   File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79,
>   in make_DAG
> for ind in range(len(subgraphs)-1, -1, -1):
> TypeError: object of type 'generator' has no len()
> 
> 
> Please, I know no python and am in a hurry to get this working… 

Left your homework for the very last day, did you? I'm sorry that you are in
a hurry, but that's not our problem.

Look at the last two lines of the error traceback. The second last tells you
the line that failed:

for ind in range(len(subgraphs)-1, -1, -1):

and the last line tells you the error:

TypeError: object of type 'generator' has no len()

The error tells you that "subgraphs" is a "generator", not a list. So you
have two choices:

- you can change "subgraphs" to be a list;

- or you can change the for-loop to not need the length of subgraphs, or the
index.


The smaller change would probably be the first, changing subgraphs. But the
better change would probably be to change the for-loop.




-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Mark Lawrence

On 26/03/2016 05:31, Juan Dent wrote:


I am trying to run ‘python cppdep.py’ but get the following:


analyzing dependencies among all components ...
Traceback (most recent call last):
   File "cppdep.py", line 675, in 
 main()
   File "cppdep.py", line 643, in main
 calculate_graph(digraph)
   File "cppdep.py", line 570, in calculate_graph
 (cycles, dict_node2cycle) = make_DAG(digraph, key_node)
   File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79, in 
make_DAG
 for ind in range(len(subgraphs)-1, -1, -1):
TypeError: object of type 'generator' has no len()

Please, I know no python and am in a hurry to get this working… Please help

Regards,
Juan



for ind in range(len(list(subgraphs))-1, -1, -1):

However please note that the above is often a code smell in Python.  The 
usual style is:-


for item in container:
doSomething(item)

Your actual problem would translate into something like:-

for subgraph in reversed(subgraphs):
doSomething(subgraph)

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


PLEASE HELP -- TOTALLY NEW TO PYTHON

2016-03-26 Thread Juan Dent

I am trying to run ‘python cppdep.py’ but get the following:


analyzing dependencies among all components ...
Traceback (most recent call last):
  File "cppdep.py", line 675, in 
main()
  File "cppdep.py", line 643, in main
calculate_graph(digraph)
  File "cppdep.py", line 570, in calculate_graph
(cycles, dict_node2cycle) = make_DAG(digraph, key_node)
  File "/Users/juandent/Downloads/cppdep-master/networkx_ext.py", line 79, in 
make_DAG
for ind in range(len(subgraphs)-1, -1, -1):
TypeError: object of type 'generator' has no len()


Please, I know no python and am in a hurry to get this working… Please help


Regards,
Juan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: please help

2016-02-04 Thread Oscar Benjamin
On 3 February 2016 at 23:03, Syavosh Malek  wrote:
> hi i install python 3.5.1 and found run time error
> see attach file and help me please

I'm afraid your attachment didn't arrive as this is a text-only
mailing list. Can you include more information about the error?

If it's that you're missing a dll called something like
Api-ms-win-crt-runtime-l1-1-0.dll then you need to update your system
runtimes from Microsoft. You can read about that here:
https://support.microsoft.com/en-us/kb/2999226

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


please help

2016-02-04 Thread Syavosh Malek
hi i install python 3.5.1 and found run time error
see attach file and help me please
-- 
https://mail.python.org/mailman/listinfo/python-list


Please help

2015-12-21 Thread Abdul Basit
I am receiving this error while installing python interpreter version 3.5.1 (32 
bit)
Error is " This program cannot start because api-ms-win-crt-runtime-l1-1-0.dll 
is missing from your computer"

I reinstalled this file but again this error message 

What should I do to remove this issue kindly help me 

Regards
 Abdul Basit 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25336] Segmentation fault on Mavericks consistent crashing of software: Please HELP!!!!!

2015-10-09 Thread CM

CM added the comment:

I understood what Ned meant, and I did seek advice from the third party 
software creator, it was the first thing I did because like you stated I 
thought it was an issue with the third party software and not python. Coming to 
this bug website was my last resort but I can see that it doesn't make sense

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25336] Segmentation fault on Mavericks consistent crashing of software: Please HELP!!!!!

2015-10-09 Thread R. David Murray

R. David Murray added the comment:

I think Ned meant "it is *not* likely to be in the python interpreter or 
standard library", and that you should seek help from the third party people 
trying to track down the problem.  *If* it turns out to be python or the 
stdlib, which means you've managed to find a reproducer that does *not* involve 
the third party packages, *then* come back and reopen the issue.

Like Ned said, good luck, but we really can't provide you any more help here 
until the third party packages are eliminated from the equation.

--
nosy: +r.david.murray
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25336] Segmentation fault on Mavericks consistent crashing of software: Please HELP!!!!!

2015-10-09 Thread CM

CM added the comment:

Hi Thanks for your response.
So as you have correctly surmised I am using a software package call oof. I ran 
the package using gdb and this is the output that I got. I'm having the same 
issue on i.e. Segmentation fault on three machines, one is a Linux 
Centos/Redhat server (Python 2.7.8), and two macs (python 2.7.10). The gdb 
output below is from the Centos Server machine. 

Again not sure if it helps but I'm only posting all the information I have 
since it wouldn't be entirely easy for me to provide a test case without you 
actually having the software package installed. Thanks in advance. 


---

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd54c0700 (LWP 22786)]
PyObject_Malloc (nbytes=32) at Objects/obmalloc.c:813
813 Objects/obmalloc.c: No such file or directory.
in Objects/obmalloc.c
Missing separate debuginfos, use: debuginfo-install expat-2.0.1-11.el6_2.x86_64 
fontconfig-2.8.0-3.el6.x86_64 freetype-2.3.11-14.el6_3.1.x86_64 
glibc-2.12-1.149.el6_6.5.x86_64 keyutils-libs-1.4-4.el6.x86_64 
krb5-libs-1.10.3-10.el6_4.6.x86_64 libICE-1.0.6-1.el6.x86_64 
libSM-1.2.1-2.el6.x86_64 libX11-1.6.0-2.2.el6.x86_64 libXau-1.0.6-4.el6.x86_64 
libXcursor-1.1.13-6.20130524git8f677eaea.el6.x86_64 
libXdamage-1.1.3-4.el6.x86_64 libXext-1.3.1-2.el6.x86_64 
libXfixes-5.0-3.el6.x86_64 libXrender-0.9.7-2.el6.x86_64 
libXt-1.1.4-6.1.el6.x86_64 libart_lgpl-2.3.20-5.1.el6.x86_64 
libcom_err-1.41.12-18.el6.x86_64 libgcc-4.4.7-4.el6.x86_64 
libgfortran-4.4.7-4.el6.x86_64 libgnomecanvas-2.26.0-4.el6.x86_64 
libgomp-4.4.7-4.el6.x86_64 libjpeg-turbo-1.2.1-3.el6_5.x86_64 
libpng-1.2.49-1.el6_2.x86_64 libselinux-2.0.94-5.3.el6_4.1.x86_64 
libstdc++-4.4.7-4.el6.x86_64 libtiff-3.9.4-10.el6_5.x86_64 
libuuid-2.17.2-12.14.el6.x86_64 libxcb-1.8.1-1.el6.x86_64 
openssl-1.0.1e-16.el6_5.15.x86_64 zlib-1.2.3-29.el6.x8
 6_64
(gdb) where
#0  PyObject_Malloc (nbytes=32) at Objects/obmalloc.c:813
#1  0x77a90c3d in _PyObject_New (tp=0x77dc3840) at 
Objects/object.c:244
#2  0x77b2cb2d in newlockobject (self=) at 
./Modules/threadmodule.c:164
#3  thread_PyThread_allocate_lock (self=) at 
./Modules/threadmodule.c:746
#4  0x77af3741 in call_function (f=, 
throwflag=) at Python/ceval.c:4017
#5  PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2679
#6  0x77af54ae in PyEval_EvalCodeEx (co=0x7fffef74bbb0, globals=, locals=, 
args=, argcount=2, kws=0x7fffa40040c8, kwcount=0, 
defs=0x7fffef771068, defcount=1, closure=0x0)
at Python/ceval.c:3265
#7  0x77af365a in fast_function (f=, 
throwflag=) at Python/ceval.c:4129
#8  call_function (f=, throwflag=) at 
Python/ceval.c:4054
#9  PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2679
#10 0x77af54ae in PyEval_EvalCodeEx (co=0x7fffef75b6b0, globals=, locals=, 
args=, argcount=1, kws=0x7fff5d3de7d8, kwcount=0, 
defs=0x7fffeecdf068, defcount=1, closure=0x0)
at Python/ceval.c:3265
#11 0x77af365a in fast_function (f=, 
throwflag=) at Python/ceval.c:4129
#12 call_function (f=, throwflag=) at 
Python/ceval.c:4054
#13 PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2679
#14 0x77af54ae in PyEval_EvalCodeEx (co=0x7fffe6669c30, globals=, locals=, 
args=, argcount=3, kws=0x7fff5d3e1bb0, kwcount=0, 
defs=0x7fffe6661fe0, defcount=2, closure=0x0)
at Python/ceval.c:3265
#15 0x77af365a in fast_function (f=, 
throwflag=) at Python/ceval.c:4129
#16 call_function (f=, throwflag=) at 
Python/ceval.c:4054
#17 PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2679
#18 0x77af54ae in PyEval_EvalCodeEx (co=0x77e2ad30, globals=, locals=, 
args=, argcount=2, kws=0x77f97068, kwcount=0, 
defs=0x0, defcount=0, closure=0x0)
at Python/ceval.c:3265
#19 0x77a73778 in function_call (func=0x7fffeece2938, 
arg=0x7fff563836c8, kw=0x7fff5642b4b0)
at Objects/funcobject.c:526
#20 0x77a441a3 in PyObject_Call (func=0x7fffeece2938, arg=, kw=)
at Objects/abstract.c:2529
#21 0x77af214a in ext_do_call (f=, 
throwflag=) at Python/ceval.c:4346
#22 PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2718
#23 0x77af54ae in PyEval_EvalCodeEx (co=0x77e342b0, globals=, locals=, 
args=, argcount=2, kws=0x77f97068, kwcount=0, 
defs=0x0, defcount=0, closure=0x0)
at Python/ceval.c:3265
#24 0x77a73778 in function_call (func=0x7fffeece2cf8, 
arg=0x7fff563cf638, kw=0x7fff5642b398)
at Objects/funcobject.c:526
#25 0x77a441a3 in PyObject_Call (func=0x7fffeece2cf8, arg=, kw=)
at Objects/abstract.c:2529
#26 0x77af214a in ext_do_call (f=, 
throwflag=) at Python/ceval.c:4346
#27 PyEval_EvalFrameEx (f=, throwflag=) at Python/ceval.c:2718
---Type  to continue, or q  to quit---

--
status: closed -> open

___
Python tracker 


[issue25336] Segmentation fault on Mavericks consistent crashing of software: Please HELP!!!!!

2015-10-08 Thread CM

New submission from CM:

Process: Python [556]
Path:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:  Python
Version: 2.7.10 (2.7.10)
Code Type:   X86-64 (Native)
Parent Process:  bash [510]
Responsible: X11.bin [452]
User ID: 502

Date/Time:   2015-10-07 17:01:32.979 -0700
OS Version:  Mac OS X 10.9.5 (13F1096)
Report Version:  11
Anonymous UUID:  34110EFA-E539-3790-15F7-F5AE427C092E

Sleep/Wake UUID: 1444CE38-3698-4FDA-95B9-196B28CB372E

Crashed Thread:  2

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x

VM Regions Near 0:
--> 
__TEXT 00010802b000-00010802d000 [8K] r-x/rwx 
SM=COW  
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib  0x7fff8d24f716 __psynch_cvwait + 10
1   libsystem_pthread.dylib 0x7fff9185dc3b _pthread_cond_wait + 
727
2   org.python.python   0x000108118f51 
PyThread_acquire_lock + 145
3   org.python.python   0x0001080dc74e PyEval_RestoreThread 
+ 62
4   org.python.python   0x000108104f6d PyGILState_Ensure + 
93
5   _gtk.so 0x000108ec4b36 
pygtk_main_watch_check + 50
6   libglib-2.0.0.dylib 0x000108c9efc0 g_main_context_check 
+ 362
7   libglib-2.0.0.dylib 0x000108c9f4ba 
g_main_context_iterate + 388
8   libglib-2.0.0.dylib 0x000108c9f714 g_main_loop_run + 195
9   libgtk-x11-2.0.0.dylib  0x00010918b5db gtk_main + 180
10  _gtk.so 0x000108e7d0ec _wrap_gtk_main + 241
11  org.python.python   0x0001080e1003 PyEval_EvalFrameEx + 
15539
12  org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
13  org.python.python   0x0001080e4c89 fast_function + 297
14  org.python.python   0x0001080e04f5 PyEval_EvalFrameEx + 
12709
15  org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
16  org.python.python   0x0001080e4c89 fast_function + 297
17  org.python.python   0x0001080e04f5 PyEval_EvalFrameEx + 
12709
18  org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
19  org.python.python   0x0001080e4c89 fast_function + 297
20  org.python.python   0x0001080e04f5 PyEval_EvalFrameEx + 
12709
21  org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
22  org.python.python   0x0001080dca16 PyEval_EvalCode + 54
23  org.python.python   0x000108106774 PyRun_FileExFlags + 
164
24  org.python.python   0x0001081062f1 
PyRun_SimpleFileExFlags + 769
25  org.python.python   0x00010811c05e Py_Main + 3070
26  libdyld.dylib   0x7fff8f24c5fd start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib  0x7fff8d250662 kevent64 + 10
1   libdispatch.dylib   0x7fff90e99421 _dispatch_mgr_invoke 
+ 239
2   libdispatch.dylib   0x7fff90e99136 _dispatch_mgr_thread 
+ 52

Thread 2 Crashed:
0   org.python.python   0x0001080853af PyObject_Malloc + 79
1   org.python.python   0x00010808 _PyObject_New + 18
2   org.python.python   0x00010811e082 
thread_PyThread_allocate_lock + 18
3   org.python.python   0x0001080e1003 PyEval_EvalFrameEx + 
15539
4   org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
5   org.python.python   0x0001080e4c89 fast_function + 297
6   org.python.python   0x0001080e04f5 PyEval_EvalFrameEx + 
12709
7   org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
8   org.python.python   0x0001080e4c89 fast_function + 297
9   org.python.python   0x0001080e04f5 PyEval_EvalFrameEx + 
12709
10  org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
11  org.python.python   0x0001080e4c89 fast_function + 297
12  org.python.python   0x0001080e04f5 PyEval_EvalFrameEx + 
12709
13  org.python.python   0x0001080dd0dd PyEval_EvalCodeEx + 
1725
14  org.python.python   0x000108068b4c function_call + 364
15  org.python.python   0x000108042fa3 PyObject_Call + 99
16  org.python.python   0x0001080e081d PyEval_EvalFrameEx + 
13517
17  org.python.python   

[issue25336] Segmentation fault on Mavericks consistent crashing of software: Please HELP!!!!!

2015-10-07 Thread Ned Deily

Ned Deily added the comment:

Without more information or a reproducible test case, it is very difficult to 
say what's going on.  But, from some of the file paths in the crash report, I'm 
guessing you are using a third-party package called OOF2 with a 
MacPorts-installed Python 2.7 and oof2 seems to have some extensions modules 
calling external libraries, like liboof2common.dylib.  There's very little to 
go on but it seems very unlikely that the crash is being caused by a bug in the 
Python interpreter or the Python standard library.  It might be due to 
something your program is doing or it might be some problem with the apparently 
complex mix of third-party libraries and Python.  You *might* have more success 
asking on an OOF mailing list or a MacPorts list but even so I would guess 
that, without a simple reproducible test case that you can share, it may be 
tough to get help.  You also might try running under a debugger like lldb.  
Please re-open this issue if you are able to isolate the problem to the Python 
inte
 rpreter or Python standard library.  Good luck!

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Please help on this sorted function

2015-06-03 Thread Gary Herron

On 06/02/2015 01:20 PM, fl wrote:

Hi,

I try to learn sorted(). With the tutorial example:





ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
ff

[1, 2, 3, 4, 5]



I don't see what sorted does in this dictionary, i.e. the sequence of
1..5 is unchanged. Could you explain it to me?


Thanks,


It's best to think of dictionaries as unordered collections of key/value 
pairs.  Dictionaries are not sequences, do not have any particular 
ordering, and in full generality *can't* be sorted in any sensible way.


For instance, this slightly odd (but perfectly legal) dictionary
 d = {'a':123, 456:'b'}
can't be sorted
 sorted(d)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unorderable types: int()  str()
because it doesn't make sense to order/compare the two keys 'a' and 456.

If your dictionary is a little better behaved, say
 d = {'a':123, 'b':456}
you may be able to sort the keys
 sorted(d)
['a', 'b']
or the values
 sorted(d.values())
[123, 456]
or the key/value tuples (called items)
 sorted(d.items())
[('a', 123), ('b', 456)]
but each of those attempts to sort could fail on a general dictionary if 
the individual keys or values are not sortable.


There is also an implementation of a type of dictionary that remembers 
the order in which the items are *inserted*.  It's in the collections 
module and called OrderedDict.



Gary Herron






--
Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418

--
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on this sorted function

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 06:42, Joonas Liik wrote:

 my_dict = {1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'}
 
 # dict.items() returns an iterator that returns pairs of (key, value)
 # pairs the key argument to sorted tells sorted what to sort by,
 operator.itemgetter is a factory function , itemgetter(1)== lambda
 iterable: iterable[1]
 sorted_dict = sorted(my_dict.items(), key=itemgetter(1))
 
 # at this moment sorted dict is a generator of key-value tuples in the
 right order
 sorted_dict = OrderedDict(sorted_dict) # turn the generator in to an
 actual dict.
 
 # notice: regular dicts are NOT ORDERED, you need a special type of dict
 # to
 preserve the order, hence OrderedDict

OrderedDicts preserve the *insertion order*, they don't sort the keys.


Ordinary dicts are unordered. The order you see is arbitrary and 
unpredictable:

py d = {}
py d['C'] = 1; d['A'] = 2; d['B'] = 3
py d
{'A': 2, 'C': 1, 'B': 3}


Ordered dicts are ordered by insertion order:

py from collections import OrderedDict
py d = OrderedDict()
py d['C'] = 1; d['A'] = 2; d['B'] = 3
py d
OrderedDict([('C', 1), ('A', 2), ('B', 3)])


Python doesn't have a SortedDict, where the keys are kept in sorted order.



-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


Please help on this sorted function

2015-06-02 Thread fl
Hi,

I try to learn sorted(). With the tutorial example:




 ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
 ff
[1, 2, 3, 4, 5]



I don't see what sorted does in this dictionary, i.e. the sequence of 
1..5 is unchanged. Could you explain it to me?


Thanks,
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on this sorted function

2015-06-02 Thread Joonas Liik
my_dict = {1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'}

# dict.items() returns an iterator that returns pairs of (key, value) pairs
# the key argument to sorted tells sorted what to sort by,
operator.itemgetter is a factory function , itemgetter(1)== lambda
iterable: iterable[1]
sorted_dict = sorted(my_dict.items(), key=itemgetter(1))

# at this moment sorted dict is a generator of key-value tuples in the
right order
sorted_dict = OrderedDict(sorted_dict) # turn the generator in to an actual
dict.

# notice: regular dicts are NOT ORDERED, you need a special type of dict to
preserve the order, hence OrderedDict
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on this sorted function

2015-06-02 Thread fl
On Tuesday, June 2, 2015 at 1:20:40 PM UTC-7, fl wrote:
 Hi,
 
 I try to learn sorted(). With the tutorial example:
 
 
 
 
  ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
  ff
 [1, 2, 3, 4, 5]
 
 
 
 I don't see what sorted does in this dictionary, i.e. the sequence of 
 1..5 is unchanged. Could you explain it to me?
 
 
 Thanks,

Excuse me. After a small modification, it can see the effect.


 ff=sorted({1: 'D', 2: 'B', 5: 'B', 4: 'E', 3: 'A'})
 ff
[1, 2, 3, 4, 5]


I am still new to Python. How to get the sorted dictionary output:

{1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on this sorted function

2015-06-02 Thread Joonas Liik
 ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
 ff
[1, 2, 3, 4, 5]

sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) is equivalent to
sorted(iter({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}))

and iter(dict) iterates over the dict keys, so when you do
iter({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) you essentially get
[1,2,3,4,5]
and sorted([1,2,3,4,5]) returns [1,2,3,4,5]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help on this sorted function

2015-06-02 Thread Chris Angelico
On Wed, Jun 3, 2015 at 6:25 AM, fl rxjw...@gmail.com wrote:
 I am still new to Python. How to get the sorted dictionary output:

 {1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'}

Since dictionaries don't actually have any sort of order to them, the
best thing to do is usually to simply display it in order. And there's
a very handy function for doing that: a pretty-printer.

 import pprint
 pprint.pprint({1: 'D', 2: 'B', 5: 'B', 4: 'E', 3: 'A'})
{1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'}

This one comes with Python, so you can use it as easily as that above
example. Or you could do it this way:

 from pprint import pprint
 pprint({1: 'D', 2: 'B', 5: 'B', 4: 'E', 3: 'A'})
{1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'}

For a lot of Python data structures, this will give you a tidy and
human-readable display.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please Help to build an addon for Anki

2015-04-20 Thread Ben Finney
Mahesh Chiramure mchirm...@gmail.com writes:

 I liked the addon Picture-flasher written for anki very much
 and I was wondering if the same thing could be done with mp3 and/or
 flac files.

Quite probably.

That sounds like a good small project to tackle: you've found a
free-software program, it has an existing feature you like, and you
want to add a similar feature. Good choice!

 I am not a programmer yet, please guide.

You'll want to collaborate with programmers. Maybe even the programmers
responsible for maintaining Anki.

 Hoping for a quick response.

Hopefully this is quick enough.

-- 
 \  “If you don't fail at least 90 percent of the time, you're not |
  `\aiming high enough.” —Alan Kay |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Please Help to build an addon for Anki

2015-04-20 Thread Mahesh Chiramure
Hi

I liked the addon Picture-flasher written for anki very much
and I was wondering if the same thing could be done with mp3 and/or
flac files. Means I am looking for an addon that chooses a random mp3
and/or flac file from a directory provided by me (to the addon as we
have to provide in Picture-flasher) and plays it on successful
reviewing of a certain number of cards (as does the addon
Picture-flasher). As a music lover, I feel that this addon can
motivate a whole lot of music lovers out there to pay a visit to Anki
on their PC and review to listen to their favorite mp3 and/or flac
files as a reward.

I am not a programmer yet, please guide.

Hoping for a quick response.

Mahesh Chirmure
# -*- coding: utf-8 -*-
# Picture-Flasher (a plugin for Anki)
# Authors:
#   Emanuel Rylke, ema-...@web.de
#   D_Malik, malik6...@gmail.com
# Version 2
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html


A simple plugin that flashes pictures on-screen to reinforce reviews.

Before using:
- Get pictures from someplace. I downloaded pictures off reddit using the 
script at https://github.com/dpbrown/RedditImageGrab
- Change all lines (in the plugin source) marked with CHANGEME according to 
your preferences.

For more details, see the post at For more details, see the post at 
http://lesswrong.com/r/discussion/lw/frc/two_anki_plugins_to_reinforce_reviewing/


from anki.hooks import addHook
from aqt import mw
from random import random, choice
from aqt.qt import QSplashScreen, QPixmap, QTimer
from os import listdir

#-- begin configuration --#
pictureDirectory = E://Family stuff//22 Feb//Personal//College//A J// 
#CHANGEME to the directory where you're storing your pictures. NB: This MUST 
end with a trailing slash e.g. D://Family stuff//19 Jan//Imgs//Wallys//, 
D://Family stuff//22 Feb//Imgs//Windows 7//.

flashTime = 3000 #CHANGEME to change how long pictures stay on the screen. The 
number is time in milliseconds.

#flashPosition = [20, 1050] #CHANGEME if you want the picture to be shown at a 
specific location. The numbers are x- and y-coordinates.

#CHANGEME: The next lines are a python dictionary associating deck names 
with probabilities of pictures being shown.
#Eg, when using the deck brainscience, you will get a picture after 30% 
of cards. When using a deck without a listed name, other is used.
#Change this according to your decks. Decks with shorter, easier cards need 
lower probabilities.
deckPicsProbabilities = {
rocketsurgery:   0.3,
brainscience :   0.5,
other:   0.1,
}
#--- end configuration ---#

pics = listdir(pictureDirectory)

def showPics():
if mw.col.decks.current()['name'] in deckPicsProbabilities:
picsProbability = deckPicsProbabilities[mw.col.decks.current()['name']]
else:
picsProbability = deckPicsProbabilities[other]

if random()  picsProbability:
mw.splash = QSplashScreen(QPixmap(pictureDirectory + choice(pics)))
try:
mw.splash.move(flashPosition[0], flashPosition[1])
except NameError:
pass
mw.splash.show()
QTimer.singleShot(flashTime, mw.splash.close)

addHook(showQuestion, showPics)
-- 
https://mail.python.org/mailman/listinfo/python-list


please help to run pylearn2

2015-02-27 Thread Amila Deepal
I try to run pylearn2 tutorial: Softmax regression using my notebook.
but i run

from pylearn2.config import yaml_parse
train = yaml_parse.load(train)
train.main_loop()

this code in my notebook i got Error.How to solve this

Please help


---
ImportError   Traceback (most recent call last)
ipython-input-6-a29d25125a51 in module()
  1 from pylearn2.config import yaml_parse
 2 train = yaml_parse.load(train)
  3 train.main_loop()

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/config/yaml_parse.pyc in 
load(stream, environ, instantiate, **kwargs)
209 string = stream.read()
210 
-- 211 proxy_graph = yaml.load(string, **kwargs)
212 if instantiate:
213 return _instantiate(proxy_graph)

/usr/lib/python2.7/dist-packages/yaml/__init__.pyc in load(stream, Loader)
 69 loader = Loader(stream)
 70 try:
--- 71 return loader.get_single_data()
 72 finally:
 73 loader.dispose()

/usr/lib/python2.7/dist-packages/yaml/constructor.pyc in get_single_data(self)
 37 node = self.get_single_node()
 38 if node is not None:
--- 39 return self.construct_document(node)
 40 return None
 41 

/usr/lib/python2.7/dist-packages/yaml/constructor.pyc in 
construct_document(self, node)
 41 
 42 def construct_document(self, node):
--- 43 data = self.construct_object(node)
 44 while self.state_generators:
 45 state_generators = self.state_generators

/usr/lib/python2.7/dist-packages/yaml/constructor.pyc in construct_object(self, 
node, deep)
 88 data = constructor(self, node)
 89 else:
--- 90 data = constructor(self, tag_suffix, node)
 91 if isinstance(data, types.GeneratorType):
 92 generator = data

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/config/yaml_parse.pyc in 
multi_constructor_obj(loader, tag_suffix, node)
356 yaml_src = yaml.serialize(node)
357 construct_mapping(node)
-- 358 mapping = loader.construct_mapping(node)
359 
360 assert hasattr(mapping, 'keys')

/usr/lib/python2.7/dist-packages/yaml/constructor.pyc in 
construct_mapping(self, node, deep)
206 if isinstance(node, MappingNode):
207 self.flatten_mapping(node)
-- 208 return BaseConstructor.construct_mapping(self, node, deep=deep)
209 
210 def construct_yaml_null(self, node):

/usr/lib/python2.7/dist-packages/yaml/constructor.pyc in 
construct_mapping(self, node, deep)
131 raise ConstructorError(while constructing a mapping, 
node.start_mark,
132 found unacceptable key (%s) % exc, 
key_node.start_mark)
-- 133 value = self.construct_object(value_node, deep=deep)
134 mapping[key] = value
135 return mapping

/usr/lib/python2.7/dist-packages/yaml/constructor.pyc in construct_object(self, 
node, deep)
 88 data = constructor(self, node)
 89 else:
--- 90 data = constructor(self, tag_suffix, node)
 91 if isinstance(data, types.GeneratorType):
 92 generator = data

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/config/yaml_parse.pyc in 
multi_constructor_obj(loader, tag_suffix, node)
370 callable = eval(tag_suffix)
371 else:
-- 372 callable = try_to_import(tag_suffix)
373 rval = Proxy(callable=callable, yaml_src=yaml_src, positionals=(),
374  keywords=mapping)

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/config/yaml_parse.pyc in 
try_to_import(tag_suffix)
297 base_msg += ' but could import %s' % modulename
298 reraise_as(ImportError(base_msg + '. Original 
exception: '
-- 299+ str(e)))
300 j += 1
301 try:

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/utils/exc.pyc in 
reraise_as(new_exc)
 88 new_exc.__cause__ = orig_exc_value
 89 new_exc.reraised = True
--- 90 six.reraise(type(new_exc), new_exc, orig_exc_traceback)

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/config/yaml_parse.pyc in 
try_to_import(tag_suffix)
290 modulename = '.'.join(pcomponents[:j])
291 try:
-- 292 exec('import %s' % modulename)
293 except Exception:
294 base_msg = 'Could not import %s' % modulename

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/config/yaml_parse.pyc in 
module()

/home/amila/Documents/Algorithm/git/pylearn2/pylearn2/models/softmax_regression.py
 in module()
 13 __maintainer__ = LISA Lab
 14 
--- 15 from pylearn2.models import mlp
 16

Re: Please help.

2015-02-09 Thread John Ladasky
On Monday, February 9, 2015 at 9:44:16 AM UTC-8, chim...@gmail.com wrote:
 Hello. Am trying to change the key words to my tribal language. Eg change 
 English language: print() to igbo language: de(). I have been stuck for 
 months I need a mentor or someone that can guide me and answer some of my 
 questions when I get stuck. Thanks..
 I will really appreciate it if someone attends to me.


In Python, functions are bound to names, exactly like other variables are.  You 
can bind any new name you want to an existing function, like this:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 print(English)
English
 de = print
 de(Igbo)
Igbo
 print(Both function names work)
Both function names work
 de(Both function names work)
Both function names work


Hope that helps you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help.

2015-02-09 Thread John Ladasky
On Monday, February 9, 2015 at 10:26:47 AM UTC-8, Dave Angel wrote:

 That will help him with the functions.  But not with the keywords.  The 
 OP didn't specify Python version, but in 3.x, print() is a function, and 
 can be rebound.  Since he said keyword, he's either mistaken, or he's 
 running 2.x
 
 But any real keywords, are a real problem.  For example, changing 'if' 
 to some other string.

That's true, Dave, he did say key words.  I only helped him with his example 
of a Python built-in function.  And you're right, shadowing key words is 
currently not possible.

Are you familiar with a program known as a talk filter?  They've been around 
for decades.  

http://www.hyperrealm.com/talkfilters/talkfilters.html

Talk filters are usually used for off-color humor, rather than for serious 
purposes.  A talk filter processes a text stream, line-by-line, typically in a 
chat room setting.  A dictionary of words, and their replacements, is defined.  

I could see a talk filter being used to translate a non-English version of 
Python into standard English Python code.  I suppose that a hook for a talk 
filter could be added to the interpreter itself.  It wouldn't be easy to change 
word order to accommodate the syntax of another language, but words themselves 
could be altered.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help.

2015-02-09 Thread Dave Angel

On 02/09/2015 01:08 PM, John Ladasky wrote:

On Monday, February 9, 2015 at 9:44:16 AM UTC-8, chim...@gmail.com wrote:

Hello. Am trying to change the key words to my tribal language. Eg change 
English language: print() to igbo language: de(). I have been stuck for months 
I need a mentor or someone that can guide me and answer some of my questions 
when I get stuck. Thanks..
I will really appreciate it if someone attends to me.



In Python, functions are bound to names, exactly like other variables are.  You 
can bind any new name you want to an existing function, like this:

Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.

print(English)

English

de = print
de(Igbo)

Igbo

print(Both function names work)

Both function names work

de(Both function names work)

Both function names work


Hope that helps you.



That will help him with the functions.  But not with the keywords.  The 
OP didn't specify Python version, but in 3.x, print() is a function, and 
can be rebound.  Since he said keyword, he's either mistaken, or he's 
running 2.x


But any real keywords, are a real problem.  For example, changing 'if' 
to some other string.


And all the library code is a problem, as they have to be individually 
translated.  And many of them are not fully in Python, but have C portions.


Then there's the return strings for exceptions, and file names for imports.

And the documentation, and the inline documentation, and reflection.

Many problems, no good solutions.  It has been considered many times by 
many good Python developers, and no reasonable solution has presented 
itself.


When I use grep at the bash command line, do I want these translated to 
English words.  Nope.  They both are acronyms, but few people know what 
they actually stand for.


I wish there were an answer, but I don't think so, other than using a 
non-language (like Esperanto) to pick all the keywords and library 
functions of a new language in.  Then that new language would be equally 
hard for all nationalities to learn.


http://legacy.python.org/workshops/1997-10/proceedings/loewis.html

http://grokbase.com/t/python/python-list/09bsr7hjwh/python-statements-keyword-localization



--
DaveA
--
https://mail.python.org/mailman/listinfo/python-list


Please help.

2015-02-09 Thread chimex60
 ‎Hello. Am trying to change the key words to my tribal language. Eg change English language: print() to igbo language: de(). I have been stuck for months I need a mentor or someone that can guide me and answer some of my questions when I get stuck. Thanks..I will really appreciate it if someone attends to me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help.

2015-02-09 Thread Steven D'Aprano
Hello Chimex, and welcome.

First, before I answer your question, I have a favour to ask. Please adjust
your email program to send Plain Text as well as (or even instead of)
so-called Rich Text. When you send Rich Text, many people here will see
your email like this:

chime...@gmail.com wrote:

 htmlheadmeta http-equiv=Content-Type content=text/plain;style
 body {  font-family: Calibri,Slate Pro,sans-serif; color:#262626
 }/style /head body data-blackberry-caret-color=#00a8df
 style=divspan style=font-family: Calibri, 'Slate Pro',
 sans-serif;‎Hello. Am trying to change the key words to my tribal
 language. Eg change English language: print() to igbo language: de(). I
 have been stuck for months I need a mentor or someone that can guide me
 and answer some of my questions when I get stuck.
 Thanks../span/divdivI will really appreciate it if someone attends
 to me./div/body/html

I hope you understand why most people won't bother to try to read or respond
to such a mess. So-called Rich Text (actually HTML) bloats your email,
making it bigger and slower than it needs to be, and it can be a security
threat to the receiver (unscrupulous people can insert hostile code in the
HTML, or web bugs, or other nasties). Or worse, it means that we're stuck
with reading people's messages in some unspeakably horrible combination of
ugly fonts, clashing colours and dancing fairies dancing across the page.
So please understand that especially on a technical forum like this,
probably 90% of of people will respond poorly to anything written in Rich
Text alone.

Moving on to your actual question:

Am trying to change the key words to my tribal
language. Eg change English language: print() to 
igbo language: de().

I know of two projects that do the same thing, ChinesePython and Teuton.


http://www.chinesepython.org/

http://reganmian.net/blog/2008/11/21/chinese-python-translating-a-programming-language/

http://www.fiber-space.de/EasyExtend/doc/teuton/teuton.htm

The Teuton page links to a post on Artima by Andy Dent which discusses this
further.

Basically, the idea is that you start with the source code to Python,
written in C, change the keywords, and recompile. If nothing breaks, you
should then be able to program using non-English keywords.

As an alternative, you might consider using a pre-processor which translates
your dialect of Python+Igbo to standard Python before running the code.
Google for LikePython and LOLPython for some ideas.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help - Python role in Emeryville, CA - Full-time - $100K+

2014-12-18 Thread David H. Lipman
It depends on if this a Job Posting, specific to Python, is allowed and not 
considered spam.
 
 -- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please help - Python role in Emeryville, CA - Full-time - $100K+

2014-12-18 Thread me
On Thu, 18 Dec 2014 00:08:18 +, Jared E. Cardon wrote:

 Hi,
 
 I found your Python group on Google+ and I'm searching for someone with
 3+ years of Python development experience for a full-time position in
 California.  Salary north of $100K and working for an amazing company. 
 Ideally I'd like to find someone who is nice, plugged into the movie and
 comic culture, and very skilled at python and web application
 development.
 
 If you know of anyone local to the area who would be interested please
 put me in touch with them.  Feel free to post my request on the group
 page.
 
 Thank you,
 Jared


Except that sisinc is a body shop and that 100k is low for any real 
programming job in California.  Used to be that contracting work paid W2 
at 150% of what you would make as a client direct hire.  Now the pimps 
look at you with a straight face and expect you to work for similar or 
less money than direct hire, with minimal to no benefits, and absolutely 
no job security.  
-- 
https://mail.python.org/mailman/listinfo/python-list


Please help - Python role in Emeryville, CA - Full-time - $100K+

2014-12-17 Thread Jared E. Cardon
Hi,

I found your Python group on Google+ and I'm searching for someone with 3+ 
years of Python development experience for a full-time position in California.  
Salary north of $100K and working for an amazing company.  Ideally I'd like to 
find someone who is nice, plugged into the movie and comic culture, and very 
skilled at python and web application development.

If you know of anyone local to the area who would be interested please put me 
in touch with them.  Feel free to post my request on the group page.

Thank you,
Jared


Jared Cardon
Account Manager
Phone: (415) 635-3764 | Cell: (646) 287-7738 | 
jcar...@sisinc.commailto:jcar...@sisinc.com | 
www.sisinc.comhttp://www.sisinc.com/

Systems Integration Solutions - A Diversity Vendor
Proud to be in our 25th year of providing IT Consulting resources and services
[cid:image004.jpg@01D01A13.ABA62E80]http://www.linkedin.com/in/jaredcardon/[Description:
 cid:image008.jpg@01CDD3B3.D1FF2B20]http://sisinc.com/job-central

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PythonCE successfully inst'ed, but scripts don't work. Please help.

2014-05-30 Thread Chris Angelico
On Fri, May 30, 2014 at 1:12 PM, Abdullah Indorewala
pwnapplei...@icloud.com wrote:
 Hi,

 I know  you posted this 15 years ago but I recently stumbled across your post 
 here :

 https://mail.python.org/pipermail/python-list/1999-May/018340.html

 And I am in the same situation (kind of). I can’t get Python to install on my 
 MobilePro 770 running Windows CE 3.0. Are you still available? Is this e-mail 
 even valid? I know I’m just some random person on the internet but I need 
 your help in installing Python to my MobilePro 770. Any help would be 
 appreciated.


Well... you've reached a valid and current mailing list (mirrored to
the comp.lang.python newsgroup), and there's plenty of activity here.
But I don't know if anyone here uses WinCE, nor if anyone has the
exact version of hardware you're using. So it's probably easiest to
just set the previous post aside and start fresh, with details like:

1) What version of Python are you trying to install?
2) What version of Windows? (You already answered that, above;
according to Wikipedia, the MobilePro 770 came with WinCE 2.11, so I'm
guessing that's been upgraded.)
3) What happens when you try to install?

I don't think Win CE is an officially-supported platform, so it's
entirely possible you'll have problems with the standard installers.
There is, however, a dedicated third-party port at
http://pythonce.sourceforge.net/ , which I found by simple Google
search for 'python wince'. That might help you, and if not, come back
with more info and maybe someone can help out.

Good luck! I'm pretty sure WinCE is appropriately named after the
facial sign of distress.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   8   >