Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile-time path saved in compiled PYC files causes issues on Powershell #6827

Closed
lukeb1961 opened this issue Jul 18, 2018 · 10 comments
Closed
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Packaging Service Attention This issue is responsible by Azure service team.

Comments

@lukeb1961
Copy link

lukeb1961 commented Jul 18, 2018

Has trdai become hard-coded?

PS C:\Users\LukeB> az cosmosdb database exists --resource-group-name $RG --key $KEY --db-name $DBNAME 
az : ERROR: unsupported operand type(s) for +: 'NoneType' and 'str'
At line:1 char:1
+ az cosmosdb database exists --resource-group-name $RG --key $KEY --db ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ERROR: unsuppor...Type' and 'str':String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\knack\cli.py", line 197, in invoke
    cmd_result = self.invocation.execute(args)
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-core\azure\cli\core\commands\__init__.py", line 334, in execute
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 96, in generic_exception_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 76, in chained_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 71, in chained_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 86, in network_exception_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 71, in chained_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 59, in unknown_server_failure_exception_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 71, in chained_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 51, in invalid_arg_found_exception_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 71, in chained_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 29, in resource_not_found_exception_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 71, in chained_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\_exception_handler.py", line 21, in duplicate_resource_exception_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-core\azure\cli\core\commands\__init__.py", line 311, in execute
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-core\azure\cli\core\commands\__init__.py", line 170, in __call__
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\knack\commands.py", line 109, in __call__
    return self.handler(*args, **kwargs)
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-core\azure\cli\core\__init__.py", line 421, in default_command_handler
  File "C:\Users\trdai\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb\custom.py", line 234, in cli_cosmosdb_database_exists
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\query_iterable.py", line 112, in __next__
    return next(self._ex_context)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 105, in __next__
    return self.next()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\execution_dispatcher.py", line 64, in next
    return next(self._execution_context)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 105, in __next__
    return self.next()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 95,
 in next
    results = self.fetch_next_block()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 73, in fetch_next_block
    return self._fetch_next_block()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 158, in _fetch_next_block
    return self._fetch_items_helper_with_retries(self._fetch_function)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 132, in _fetch_items_helper_with_retries
    return retry_utility._Execute(self._client, self._client._global_endpoint_manager, callback)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\retry_utility.py", line 56, in _Execute
    result = _ExecuteFunction(function, *args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\retry_utility.py", line 92, in _ExecuteFunction
    return function(*args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 130, in callback
    return self._fetch_items_helper_no_retries(fetch_function)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\execution_context\base_execution_context.py", line 120, in _fetch_items_helper_no_retries
    (fetched_items, response_headers) = fetch_function(self._options)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\document_client.py", line 282, in fetch_fn
    options), self.last_response_headers
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\document_client.py", line 2685, in __QueryFeed
    url_connection = self._global_endpoint_manager.ReadEndpoint
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\global_endpoint_manager.py", line 48, in ReadEndpoint
    self.RefreshEndpointList()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\global_endpoint_manager.py", line 67, in RefreshEndpointList
    database_account = self._GetDatabaseAccount()
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\global_endpoint_manager.py", line 85, in _GetDatabaseAccount
    database_account = self._GetDatabaseAccountStub(self.DefaultEndpoint)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\global_endpoint_manager.py", line 105, in _GetDatabaseAccountStub
    return self.Client.GetDatabaseAccount(endpoint)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\document_client.py", line 2309, in GetDatabaseAccount
    headers)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\document_client.py", line 2546, in __Get
    headers)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\pydocumentdb\synchronized_request.py", line 210, in SynchronizedRequest
    resource_url = base_url + request_options['path']
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

PS C:\Users\LukeB> az --version
azure-cli (2.0.41)

acr (2.0.28)
acs (2.1.3)
advisor (0.5.1)
ams (0.1.1)
appservice (0.1.36)
backup (1.1.2)
batch (3.2.4)
batchai (0.3.1)
billing (0.1.8)
cdn (0.0.14)
cloud (2.0.15)
cognitiveservices (0.1.13)
command-modules-nspkg (2.0.1)
configure (2.0.17)
consumption (0.3.1)
container (0.2.1)
core (2.0.41)
cosmosdb (0.1.21)
dla (0.1.0)
dls (0.0.22)
dms (0.0.1)
eventgrid (0.1.12)
eventhubs (0.1.3)
extension (0.1.0)
feedback (2.1.3)
find (0.2.11)
interactive (0.3.25)
iot (0.1.21)
keyvault (2.0.23)
lab (0.0.22)
maps (0.2.0)
monitor (0.1.8)
network (2.1.5)
nspkg (3.0.2)
policyinsights (0.1.0)
profile (2.0.27)
rdbms (0.2.5)
redis (0.2.14)
reservations (0.2.1)
resource (2.0.32)
role (2.0.26)
servicebus (0.1.2)
servicefabric (0.0.12)
sql (2.0.27)
storage (2.0.35)
vm (2.0.35)

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\LukeB\.azure\cliextensions'

Python (Windows) 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal
@tjprescott tjprescott added CosmosDB az cosmosdb bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Jul 18, 2018
@tjprescott
Copy link
Member

@troydai can you comment?

@troydai
Copy link
Contributor

troydai commented Jul 18, 2018

What ...

@tjprescott
Copy link
Member

tjprescott commented Jul 18, 2018

File "C:\Users*trdai*\AppData\Local\Temp\pip-install-pfctf_lg\azure-cli-cosmosdb\azure\cli\command_modules\cosmosdb_exception_handler.py", line 76, in chained_handler

@troydai
Copy link
Contributor

troydai commented Jul 18, 2018

I know. I don't see that string in the source code.

@troydai
Copy link
Contributor

troydai commented Jul 18, 2018

looking into the windows installer

@troydai
Copy link
Contributor

troydai commented Jul 18, 2018

This is not because the trdai is hard-coded. This is because we release compiled pyc file, therefore, the compile-time path is captured.

The command failure is caused by running az command in a powershell terminal, where $ has different meaning.

@tjprescott tjprescott added Packaging and removed CosmosDB az cosmosdb bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Jul 18, 2018
@tjprescott
Copy link
Member

So then this is more of a packaging issue?

@tjprescott tjprescott changed the title az CosmosDB commands broken in 2.0.41 Compile-time path saved in compiled PYC files causes issues on Powershell Jul 18, 2018
@troydai
Copy link
Contributor

troydai commented Jul 20, 2018

@tjprescott the main issue is not caused by the pyc. The pyc just introduce a minor issue where the compile time path is "persisted" in the build. It doesn't affect the functionality.

@troydai
Copy link
Contributor

troydai commented Jul 20, 2018

The root issue is #6770

@troydai troydai added bug This issue requires a change to an existing behavior in the product in order to be resolved. CosmosDB az cosmosdb labels Jul 20, 2018
@tjprescott
Copy link
Member

In that case it sounds like this is a dupe and I will close this.

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@haroldrandom haroldrandom added bug This issue requires a change to an existing behavior in the product in order to be resolved. CosmosDB Packaging Service Attention This issue is responsible by Azure service team. labels Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Packaging Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

5 participants